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

Feature/minor test improvements #47

Merged
merged 2 commits into from
Sep 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/ArrayInputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function mixedValueProvider()
{
$dataSets = parent::mixedValueProvider();
array_walk($dataSets, function (&$set) {
$set[0] = [$set[0]]; // Wrap value into an array.
$set['raw'] = [$set['raw']]; // Wrap value into an array.
});

return $dataSets;
Expand Down
21 changes: 21 additions & 0 deletions test/FileInputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,4 +456,25 @@ public function emptyValueProvider()
],
];
}

public function mixedValueProvider()
{
$fooUploadErrOk = [
'tmp_name' => 'foo',
'error' => UPLOAD_ERR_OK,
];

return [
'single' => [
'raw' => $fooUploadErrOk,
'filtered' => $fooUploadErrOk,
],
'multi' => [
'raw' => [
$fooUploadErrOk,
],
'filtered' => $fooUploadErrOk,
],
];
}
}
62 changes: 50 additions & 12 deletions test/InputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ public function testIsRequiredVsAllowEmptyVsContinueIfEmptyVsIsValid(
'isValid() value not match. Detail: ' . json_encode($this->input->getMessages())
);
$this->assertEquals($expectedMessages, $this->input->getMessages(), 'getMessages() value not match');
$this->assertEquals($value, $this->input->getRawValue(), 'getRawValue() must return the value always');
$this->assertEquals($value, $this->input->getValue(), 'getValue() must return the filtered value always');
}

/**
Expand Down Expand Up @@ -551,19 +553,55 @@ public function mixedValueProvider()
{
return [
// Description => [$value]
'"0"' => ['0'],
'0' => [0],
'0.0' => [0.0],
'false' => [false],
'php' => ['php'],
'whitespace' => [' '],
'1' => [1],
'1.0' => [1.0],
'true' => [true],
'["php"]' => [['php']],
'object' => [new stdClass()],
'"0"' => [
'raw' => '0',
'filtered' => '0',
],
'0' => [
'raw' => 0,
'filtered' => 0,
],
'0.0' => [
'raw' => 0.0,
'filtered' => 0.0,
],
'false' => [
'raw' => false,
'filtered' => false,
],
'php' => [
'raw' => 'php',
'filtered' => 'php',
],
'whitespace' => [
'raw' => ' ',
'filtered' => ' ',
],
'1' => [
'raw' => 1,
'filtered' => 1,
],
'1.0' => [
'raw' => 1.0,
'filtered' => 1.0,
],
'true' => [
'raw' => true,
'filtered' => true,
],
'["php"]' => [
'raw' => ['php'],
'filtered' => ['php'],
],
'object' => [
'raw' => new stdClass(),
'filtered' => new stdClass(),
],
// @codingStandardsIgnoreStart
'callable' => [function () {}],
'callable' => [
'raw' => function () {},
'filtered' => function () {},
],
// @codingStandardsIgnoreEnd
];
}
Expand Down