Skip to content

Commit

Permalink
MNT Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Oct 14, 2024
1 parent 81cba4e commit 6f0b4f0
Showing 1 changed file with 34 additions and 9 deletions.
43 changes: 34 additions & 9 deletions tests/php/Control/UserDefinedFormControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]'
],
]
];
}
Expand All @@ -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));
}
}

0 comments on commit 6f0b4f0

Please sign in to comment.