Skip to content

Commit

Permalink
Traditional array syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
uuf6429 committed Jul 12, 2023
1 parent 58f3bef commit c1e281e
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tests/Form/GeneralTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ public function testFormSubmitWays(string $submitVia)

public static function formSubmitWaysDataProvider(): array
{
return [
['Save'],
['input-type-image'],
['button-without-type'],
['button-type-submit'],
];
return array(
array('Save'),
array('input-type-image'),
array('button-without-type'),
array('button-type-submit'),
);
}

public function testFormSubmit()
Expand Down Expand Up @@ -359,31 +359,31 @@ public function testSetInvalidValueInField(string $field, $value)

$webAssert = $this->getAssertSession();

$color = $webAssert->elementExists('named', ['id_or_name', $field]);
$color = $webAssert->elementExists('named', array('id_or_name', $field));

$this->expectException(DriverException::class);
$color->setValue($value);
}

public static function provideInvalidValues(): iterable
{
$nullValue = ['null', null];
$trueValue = ['true', true];
$falseValue = ['false', false];
$arrayValue = ['array', ['bad']];
$stringValue = ['string', 'updated'];
$nullValue = array('null', null);
$trueValue = array('true', true);
$falseValue = array('false', false);
$arrayValue = array('array', array('bad'));
$stringValue = array('string', 'updated');

$scenarios = [
$scenarios = array(
// field type, name or id, list of values to check
['file', 'about', [$nullValue, $trueValue, $falseValue, $arrayValue]],
['textarea', 'notes', [$nullValue, $trueValue, $falseValue, $arrayValue]],
['text', 'first_name', [$nullValue, $trueValue, $falseValue, $arrayValue]],
['button', 'submit', [$nullValue, $trueValue, $falseValue, $arrayValue, $stringValue]],
];
array('file', 'about', array($nullValue, $trueValue, $falseValue, $arrayValue)),
array('textarea', 'notes', array($nullValue, $trueValue, $falseValue, $arrayValue)),
array('text', 'first_name', array($nullValue, $trueValue, $falseValue, $arrayValue)),
array('button', 'submit', array($nullValue, $trueValue, $falseValue, $arrayValue, $stringValue)),
);

foreach ($scenarios as [$fieldType, $fieldNameOrId, $values]) {
foreach ($values as [$valueDesc, $actualValue]) {
yield "$fieldType field with $valueDesc" => [$fieldNameOrId, $actualValue];
yield "$fieldType field with $valueDesc" => array($fieldNameOrId, $actualValue);
}
}
}
Expand Down

0 comments on commit c1e281e

Please sign in to comment.