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

Commit 49942f9

Browse files
committed
Remove legacy setFallbackValue tests
1 parent 225ae39 commit 49942f9

File tree

4 files changed

+0
-148
lines changed

4 files changed

+0
-148
lines changed

test/ArrayInputTest.php

-33
Original file line numberDiff line numberDiff line change
@@ -249,39 +249,6 @@ public function testDoNotInjectNotEmptyValidatorIfAnywhereInChain()
249249
$this->assertEquals($notEmptyMock, $validators[1]['instance']);
250250
}
251251

252-
public function dataFallbackValue()
253-
{
254-
return [
255-
[
256-
'fallbackValue' => []
257-
],
258-
[
259-
'fallbackValue' => [''],
260-
],
261-
[
262-
'fallbackValue' => [null],
263-
],
264-
[
265-
'fallbackValue' => ['some value'],
266-
],
267-
];
268-
}
269-
270-
/**
271-
* @dataProvider dataFallbackValue
272-
*/
273-
public function testFallbackValue($fallbackValue)
274-
{
275-
$this->input->setFallbackValue($fallbackValue);
276-
$validator = new Validator\Date();
277-
$this->input->getValidatorChain()->attach($validator);
278-
$this->input->setValue(['123']); // not a date
279-
280-
$this->assertTrue($this->input->isValid());
281-
$this->assertEmpty($this->input->getMessages());
282-
$this->assertSame($fallbackValue, $this->input->getValue());
283-
}
284-
285252
public function emptyValuesProvider()
286253
{
287254
return [

test/BaseInputFilterTest.php

-80
Original file line numberDiff line numberDiff line change
@@ -1035,86 +1035,6 @@ public function testEmptyValuePassedForRequiredButAllowedEmptyInputShouldMarkInp
10351035
$this->assertTrue($filter->isValid(), 'Empty value should mark input filter as valid');
10361036
}
10371037

1038-
/**
1039-
* @group 10
1040-
*/
1041-
public function testMissingRequiredWithFallbackShouldMarkInputValid()
1042-
{
1043-
$foo = new Input('foo');
1044-
$foo->setRequired(true);
1045-
$foo->setAllowEmpty(false);
1046-
1047-
$bar = new Input('bar');
1048-
$bar->setRequired(true);
1049-
$bar->setFallbackValue('baz');
1050-
1051-
$filter = new InputFilter();
1052-
$filter->add($foo);
1053-
$filter->add($bar);
1054-
1055-
$filter->setData(['foo' => 'xyz']);
1056-
$this->assertTrue($filter->isValid(), 'Missing input with fallback value should mark input filter as valid');
1057-
$data = $filter->getValues();
1058-
$this->assertArrayHasKey('bar', $data);
1059-
$this->assertEquals($bar->getFallbackValue(), $data['bar']);
1060-
}
1061-
1062-
/**
1063-
* @group 10
1064-
*/
1065-
public function testMissingRequiredThatAllowsEmptyWithFallbackShouldMarkInputValid()
1066-
{
1067-
$foo = new Input('foo');
1068-
$foo->setRequired(true);
1069-
$foo->setAllowEmpty(false);
1070-
1071-
$bar = new Input('bar');
1072-
$bar->setRequired(true);
1073-
$bar->setAllowEmpty(true);
1074-
$bar->setFallbackValue('baz');
1075-
1076-
$filter = new InputFilter();
1077-
$filter->add($foo);
1078-
$filter->add($bar);
1079-
1080-
$filter->setData(['foo' => 'xyz']);
1081-
$this->assertTrue($filter->isValid(), 'Missing input with fallback value should mark input filter as valid');
1082-
$data = $filter->getValues();
1083-
$this->assertArrayHasKey('bar', $data);
1084-
$this->assertEquals($bar->getFallbackValue(), $data['bar']);
1085-
$this->assertArrayNotHasKey('bar', $filter->getValidInput());
1086-
$this->assertArrayNotHasKey('bar', $filter->getInvalidInput());
1087-
}
1088-
1089-
/**
1090-
* @group 10
1091-
*/
1092-
public function testEmptyRequiredValueWithFallbackShouldMarkInputValid()
1093-
{
1094-
$foo = new Input('foo');
1095-
$foo->setRequired(true);
1096-
$foo->setAllowEmpty(false);
1097-
1098-
$bar = new Input('bar');
1099-
$bar->setRequired(true);
1100-
$bar->setFallbackValue('baz');
1101-
1102-
$filter = new InputFilter();
1103-
$filter->add($foo);
1104-
$filter->add($bar);
1105-
1106-
$filter->setData([
1107-
'foo' => 'xyz',
1108-
'bar' => null,
1109-
]);
1110-
$this->assertTrue($filter->isValid(), 'Empty input with fallback value should mark input filter as valid');
1111-
$data = $filter->getValues();
1112-
$this->assertArrayHasKey('bar', $data);
1113-
$this->assertEquals($bar->getFallbackValue(), $data['bar']);
1114-
$this->assertArrayHasKey('bar', $filter->getValidInput());
1115-
$this->assertArrayNotHasKey('bar', $filter->getInvalidInput());
1116-
}
1117-
11181038
/**
11191039
* @group 15
11201040
*/

test/FileInputTest.php

-5
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,6 @@ public function testMerge()
364364
$this->assertInstanceOf('Zend\Filter\StringTrim', $filters[0]);
365365
}
366366

367-
public function testFallbackValue($fallbackValue = null)
368-
{
369-
$this->markTestSkipped('Not use fallback value');
370-
}
371-
372367
public function testIsEmptyFileNotArray()
373368
{
374369
$rawValue = 'file';

test/InputTest.php

-30
Original file line numberDiff line numberDiff line change
@@ -443,36 +443,6 @@ public function testDoNotInjectNotEmptyValidatorIfAnywhereInChain()
443443
$this->assertEquals($notEmptyMock, $validators[1]['instance']);
444444
}
445445

446-
public function dataFallbackValue()
447-
{
448-
return [
449-
[
450-
'fallbackValue' => null
451-
],
452-
[
453-
'fallbackValue' => ''
454-
],
455-
[
456-
'fallbackValue' => 'some value'
457-
],
458-
];
459-
}
460-
461-
/**
462-
* @dataProvider dataFallbackValue
463-
*/
464-
public function testFallbackValue($fallbackValue)
465-
{
466-
$this->input->setFallbackValue($fallbackValue);
467-
$validator = new Validator\Date();
468-
$this->input->getValidatorChain()->attach($validator);
469-
$this->input->setValue('123'); // not a date
470-
471-
$this->assertTrue($this->input->isValid());
472-
$this->assertEmpty($this->input->getMessages());
473-
$this->assertSame($fallbackValue, $this->input->getValue());
474-
}
475-
476446
public function testMergeRetainsContinueIfEmptyFlag()
477447
{
478448
$input = new Input('foo');

0 commit comments

Comments
 (0)