public function RangeFromGreaterToConstraintValidatorTest::providerValidate in Range 8
Data provider for testValidate().
Return value
array Nested arrays of values to check:
- $item
- $valid
File
- tests/
src/ Unit/ Plugin/ Validation/ Constraint/ RangeFromGreaterToConstraintValidatorTest.php, line 58
Class
- RangeFromGreaterToConstraintValidatorTest
- Tests the RangeFromGreaterToConstraintValidator validator.
Namespace
Drupal\Tests\range\Unit\Plugin\Validation\ConstraintCode
public function providerValidate() {
$data = [];
$cases = [
[
'range' => [
'from' => 5,
'to' => 10,
],
'valid' => TRUE,
],
[
'range' => [
'from' => 10,
'to' => 10,
],
'valid' => TRUE,
],
[
'range' => [
'from' => 10,
'to' => 5,
],
'valid' => FALSE,
],
];
foreach ($cases as $case) {
$item = $this
->createMock('Drupal\\range\\RangeItemInterface');
$item
->expects($this
->any())
->method('getValue')
->willReturn($case['range']);
$data[] = [
$item,
$case['valid'],
];
}
return $data;
}