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

Commit 392667c

Browse files
committed
Merge pull request #47 in develop
2 parents 6eb97a1 + ee59046 commit 392667c

File tree

3 files changed

+72
-13
lines changed

3 files changed

+72
-13
lines changed

test/ArrayInputTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public function mixedValueProvider()
208208
{
209209
$dataSets = parent::mixedValueProvider();
210210
array_walk($dataSets, function (&$set) {
211-
$set[0] = [$set[0]]; // Wrap value into an array.
211+
$set['raw'] = [$set['raw']]; // Wrap value into an array.
212212
});
213213

214214
return $dataSets;

test/FileInputTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,4 +456,25 @@ public function emptyValueProvider()
456456
],
457457
];
458458
}
459+
460+
public function mixedValueProvider()
461+
{
462+
$fooUploadErrOk = [
463+
'tmp_name' => 'foo',
464+
'error' => UPLOAD_ERR_OK,
465+
];
466+
467+
return [
468+
'single' => [
469+
'raw' => $fooUploadErrOk,
470+
'filtered' => $fooUploadErrOk,
471+
],
472+
'multi' => [
473+
'raw' => [
474+
$fooUploadErrOk,
475+
],
476+
'filtered' => $fooUploadErrOk,
477+
],
478+
];
479+
}
459480
}

test/InputTest.php

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ public function testIsRequiredVsAllowEmptyVsContinueIfEmptyVsIsValid(
350350
'isValid() value not match. Detail: ' . json_encode($this->input->getMessages())
351351
);
352352
$this->assertEquals($expectedMessages, $this->input->getMessages(), 'getMessages() value not match');
353+
$this->assertEquals($value, $this->input->getRawValue(), 'getRawValue() must return the value always');
354+
$this->assertEquals($value, $this->input->getValue(), 'getValue() must return the filtered value always');
353355
}
354356

355357
/**
@@ -551,19 +553,55 @@ public function mixedValueProvider()
551553
{
552554
return [
553555
// Description => [$value]
554-
'"0"' => ['0'],
555-
'0' => [0],
556-
'0.0' => [0.0],
557-
'false' => [false],
558-
'php' => ['php'],
559-
'whitespace' => [' '],
560-
'1' => [1],
561-
'1.0' => [1.0],
562-
'true' => [true],
563-
'["php"]' => [['php']],
564-
'object' => [new stdClass()],
556+
'"0"' => [
557+
'raw' => '0',
558+
'filtered' => '0',
559+
],
560+
'0' => [
561+
'raw' => 0,
562+
'filtered' => 0,
563+
],
564+
'0.0' => [
565+
'raw' => 0.0,
566+
'filtered' => 0.0,
567+
],
568+
'false' => [
569+
'raw' => false,
570+
'filtered' => false,
571+
],
572+
'php' => [
573+
'raw' => 'php',
574+
'filtered' => 'php',
575+
],
576+
'whitespace' => [
577+
'raw' => ' ',
578+
'filtered' => ' ',
579+
],
580+
'1' => [
581+
'raw' => 1,
582+
'filtered' => 1,
583+
],
584+
'1.0' => [
585+
'raw' => 1.0,
586+
'filtered' => 1.0,
587+
],
588+
'true' => [
589+
'raw' => true,
590+
'filtered' => true,
591+
],
592+
'["php"]' => [
593+
'raw' => ['php'],
594+
'filtered' => ['php'],
595+
],
596+
'object' => [
597+
'raw' => new stdClass(),
598+
'filtered' => new stdClass(),
599+
],
565600
// @codingStandardsIgnoreStart
566-
'callable' => [function () {}],
601+
'callable' => [
602+
'raw' => function () {},
603+
'filtered' => function () {},
604+
],
567605
// @codingStandardsIgnoreEnd
568606
];
569607
}

0 commit comments

Comments
 (0)