-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1336 from creative-commoners/pulls/7/field-valida…
…tors MNT Fix unit test
- Loading branch information
Showing
1 changed file
with
34 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -584,16 +584,41 @@ public function testParseByteSizeStringBadValuesThrowException($input) | |
public static function provideValidEmailsToArray() | ||
{ | ||
return [ | ||
[[], [null]], | ||
[[], [' , , ']], | ||
[[], ['broken.email, [email protected], broken2.@email']], | ||
[ | ||
['broken@email', '[email protected]'], | ||
[', broken@email, [email protected],[email protected],'] | ||
'input' => [ | ||
null | ||
], | ||
'expected' => [], | ||
], | ||
[ | ||
['[email protected]', '[email protected]', '[email protected]'], | ||
['[email protected], [email protected], [email protected]'] | ||
'input' => [ | ||
' , , ' | ||
], | ||
'expected' => [], | ||
], | ||
[ | ||
'input' => [ | ||
'broken.email, [email protected], broken2.@email' | ||
], | ||
'expected' => [], | ||
], | ||
[ | ||
'input' => [ | ||
', broken@email, [email protected],[email protected],' | ||
], | ||
'expected' => [ | ||
'[email protected]' | ||
], | ||
], | ||
[ | ||
'input' => [ | ||
'[email protected], [email protected], [email protected]' | ||
], | ||
'expected' => [ | ||
'[email protected]', | ||
'[email protected]', | ||
'[email protected]' | ||
], | ||
] | ||
]; | ||
} | ||
|
@@ -602,14 +627,14 @@ public static function provideValidEmailsToArray() | |
* Test that provided email is valid | ||
*/ | ||
#[DataProvider('provideValidEmailsToArray')] | ||
public function testValidEmailsToArray(array $expectedOutput, array $input) | ||
public function testValidEmailsToArray(array $input, array $expected) | ||
{ | ||
$class = new ReflectionClass(UserDefinedFormController::class); | ||
$method = $class->getMethod('validEmailsToArray'); | ||
$method->setAccessible(true); | ||
|
||
$controller = new UserDefinedFormController(); | ||
|
||
$this->assertEquals($expectedOutput, $method->invokeArgs($controller, $input)); | ||
$this->assertEquals($expected, $method->invokeArgs($controller, $input)); | ||
} | ||
} |