Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions test/InflectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,12 @@ public function testSetFilterRuleWithFilterObjectCreatesRuleEntryWithFilterObjec
$this->assertSame($filter, $received);
}

public function testSetFilterRuleWithArrayOfRulesCreatesRuleEntries()
public function testAddFilterRuleAppendsRuleEntries()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$rules = $this->inflector->getRules();
$this->assertEquals(0, count($rules));
$this->inflector->setFilterRule('controller', array('PregReplace', 'Alpha'));
Expand All @@ -118,18 +122,6 @@ public function testSetFilterRuleWithArrayOfRulesCreatesRuleEntries()
$this->assertTrue($rules[1] instanceof \Zend\Filter\FilterInterface);
}

public function testAddFilterRuleAppendsRuleEntries()
{
$rules = $this->inflector->getRules();
$this->assertEquals(0, count($rules));
$this->inflector->setFilterRule('controller', 'PregReplace');
$rules = $this->inflector->getRules('controller');
$this->assertEquals(1, count($rules));
$this->inflector->addFilterRule('controller', 'Alpha');
$rules = $this->inflector->getRules('controller');
$this->assertEquals(2, count($rules));
}

public function testSetStaticRuleCreatesScalarRuleEntry()
{
$rules = $this->inflector->getRules();
Expand Down Expand Up @@ -166,6 +158,10 @@ public function testSetStaticRuleReferenceAllowsUpdatingRuleByReference()

public function testAddRulesCreatesAppropriateRuleEntries()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$rules = $this->inflector->getRules();
$this->assertEquals(0, count($rules));
$this->inflector->addRules(array(
Expand All @@ -180,6 +176,10 @@ public function testAddRulesCreatesAppropriateRuleEntries()

public function testSetRulesCreatesAppropriateRuleEntries()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$this->inflector->setStaticRule('some-rules', 'some-value');
$rules = $this->inflector->getRules();
$this->assertEquals(1, count($rules));
Expand All @@ -195,6 +195,10 @@ public function testSetRulesCreatesAppropriateRuleEntries()

public function testGetRule()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$this->inflector->setFilterRule(':controller', array('Alpha', 'StringToLower'));
$this->assertTrue($this->inflector->getRule('controller', 1) instanceof \Zend\Filter\StringToLower);
$this->assertFalse($this->inflector->getRule('controller', 2));
Expand Down Expand Up @@ -410,6 +414,10 @@ public function testNoInflectableTarget()
*/
public function testAddFilterRuleMultipleTimes()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$rules = $this->inflector->getRules();
$this->assertEquals(0, count($rules));
$this->inflector->setFilterRule('controller', 'PregReplace');
Expand Down

0 comments on commit 9e7e067

Please sign in to comment.