From 21880e89500704df15015977aa79d5fdec5d728c Mon Sep 17 00:00:00 2001 From: Koopzington Date: Tue, 27 Sep 2016 21:33:51 +0200 Subject: [PATCH 1/3] Added test for clearFallbackValue --- test/InputTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/InputTest.php b/test/InputTest.php index 82dc349d..b3e31c43 100644 --- a/test/InputTest.php +++ b/test/InputTest.php @@ -138,6 +138,17 @@ public function testSetFallbackValue($fallbackValue) $this->assertEquals(true, $input->hasFallback(), 'hasFallback() value not match'); } + /** + * @dataProvider setValueProvider + */ + public function testClearFallbackValue($fallbackValue) + { + $input = $this->input; + $input->setFallbackValue($fallbackValue); + $input->clearFallbackValue(); + $this->assertEquals(null, $input->getFallbackValue(), 'getFallbackValue() value not match'); + $this->assertEquals(false, $input->hasFallback(), 'hasFallback() value not match'); + } /** * @dataProvider fallbackValueVsIsValidProvider */ From 64d3e2d397b6e1692efd167ed09c0e68568bb055 Mon Sep 17 00:00:00 2001 From: Koopzington Date: Tue, 27 Sep 2016 21:55:38 +0200 Subject: [PATCH 2/3] Added tests for clearing methods --- test/FactoryTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/FactoryTest.php b/test/FactoryTest.php index 229fe41e..dfe4762d 100644 --- a/test/FactoryTest.php +++ b/test/FactoryTest.php @@ -988,6 +988,20 @@ public function testCreateInputFilterUsesConfiguredNameForNestedInputFilters() $this->assertTrue($collectionInputFilter->has('bat')); } + public function testClearDefaultFilterChain() + { + $factory = $this->createDefaultFactory(); + $factory->clearDefaultFilterChain(); + $this->assertEquals(null, $factory->getDefaultFilterChain()); + } + + public function testClearDefaultValidatorChain() + { + $factory = $this->createDefaultFactory(); + $factory->clearDefaultValidatorChain(); + $this->assertEquals(null, $factory->getDefaultValidatorChain()); + } + /** * @return Factory */ From 0411b9ec235ac07b480c398b6f77124080ec5d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Unger?= Date: Wed, 28 Sep 2016 11:05:43 +0200 Subject: [PATCH 3/3] Replaced assertEquals(null with assertNull(, assertEquals(true with assertTrue( and assertEquals(false with assertFalse( --- test/FactoryTest.php | 4 ++-- test/InputTest.php | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/FactoryTest.php b/test/FactoryTest.php index dfe4762d..c3c62d10 100644 --- a/test/FactoryTest.php +++ b/test/FactoryTest.php @@ -992,14 +992,14 @@ public function testClearDefaultFilterChain() { $factory = $this->createDefaultFactory(); $factory->clearDefaultFilterChain(); - $this->assertEquals(null, $factory->getDefaultFilterChain()); + $this->assertNull($factory->getDefaultFilterChain()); } public function testClearDefaultValidatorChain() { $factory = $this->createDefaultFactory(); $factory->clearDefaultValidatorChain(); - $this->assertEquals(null, $factory->getDefaultValidatorChain()); + $this->assertNull($factory->getDefaultValidatorChain()); } /** diff --git a/test/InputTest.php b/test/InputTest.php index b3e31c43..fb84c42e 100644 --- a/test/InputTest.php +++ b/test/InputTest.php @@ -135,7 +135,7 @@ public function testSetFallbackValue($fallbackValue) $this->assertSame($input, $return, 'setFallbackValue() must return it self'); $this->assertEquals($fallbackValue, $input->getFallbackValue(), 'getFallbackValue() value not match'); - $this->assertEquals(true, $input->hasFallback(), 'hasFallback() value not match'); + $this->assertTrue($input->hasFallback(), 'hasFallback() value not match'); } /** @@ -146,8 +146,8 @@ public function testClearFallbackValue($fallbackValue) $input = $this->input; $input->setFallbackValue($fallbackValue); $input->clearFallbackValue(); - $this->assertEquals(null, $input->getFallbackValue(), 'getFallbackValue() value not match'); - $this->assertEquals(false, $input->hasFallback(), 'hasFallback() value not match'); + $this->assertNull($input->getFallbackValue(), 'getFallbackValue() value not match'); + $this->assertFalse($input->hasFallback(), 'hasFallback() value not match'); } /** * @dataProvider fallbackValueVsIsValidProvider @@ -552,8 +552,8 @@ public function testMerge() $this->assertEquals('bazInput', $target->getName(), 'getName() value not match'); $this->assertEquals('bazErrorMessage', $target->getErrorMessage(), 'getErrorMessage() value not match'); - $this->assertEquals(true, $target->breakOnFailure(), 'breakOnFailure() value not match'); - $this->assertEquals(true, $target->isRequired(), 'isRequired() value not match'); + $this->assertTrue($target->breakOnFailure(), 'breakOnFailure() value not match'); + $this->assertTrue($target->isRequired(), 'isRequired() value not match'); $this->assertEquals($sourceRawValue, $target->getRawValue(), 'getRawValue() value not match'); $this->assertTrue($target->hasValue(), 'hasValue() value not match'); } @@ -574,7 +574,7 @@ public function testInputMergeWithoutValues() $return = $target->merge($source); $this->assertSame($target, $return, 'merge() must return it self'); - $this->assertEquals(true, $target->continueIfEmpty(), 'continueIfEmpty() value not match'); + $this->assertTrue($target->continueIfEmpty(), 'continueIfEmpty() value not match'); $this->assertFalse($target->hasValue(), 'hasValue() value not match'); } @@ -594,7 +594,7 @@ public function testInputMergeWithSourceValue() $return = $target->merge($source); $this->assertSame($target, $return, 'merge() must return it self'); - $this->assertEquals(true, $target->continueIfEmpty(), 'continueIfEmpty() value not match'); + $this->assertTrue($target->continueIfEmpty(), 'continueIfEmpty() value not match'); $this->assertEquals(['foo'], $target->getRawValue(), 'getRawValue() value not match'); $this->assertTrue($target->hasValue(), 'hasValue() value not match'); } @@ -615,7 +615,7 @@ public function testInputMergeWithTargetValue() $return = $target->merge($source); $this->assertSame($target, $return, 'merge() must return it self'); - $this->assertEquals(true, $target->continueIfEmpty(), 'continueIfEmpty() value not match'); + $this->assertTrue($target->continueIfEmpty(), 'continueIfEmpty() value not match'); $this->assertEquals(['foo'], $target->getRawValue(), 'getRawValue() value not match'); $this->assertTrue($target->hasValue(), 'hasValue() value not match'); }