function ClassResolverConstraintValidatorTest::provideServiceValidationCases
Data provider for service validation test cases.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ TypedData/ ClassResolverConstraintValidatorTest.php, line 77
Class
- ClassResolverConstraintValidatorTest
- Tests ClassResolver validation constraint with both valid and invalid values.
Namespace
Drupal\KernelTests\Core\TypedDataCode
public static function provideServiceValidationCases() : array {
return [
'false result' => [
'method' => 'returnFalse',
'expected_violations' => 1,
'message' => 'Validation failed when returning FALSE.',
'expected_violation_message' => 'Calling \'returnFalse\' method with value \'1\' on \'test.service\' evaluated as invalid.',
],
'true result' => [
'method' => 'returnTrue',
'expected_violations' => 0,
'message' => 'Validation succeeds when returning TRUE.',
],
'truthy result' => [
'method' => 'returnNotTrue',
'expected_violations' => 1,
'message' => 'Validation fails when returning \'true\'.',
'expected_violation_message' => 'Calling \'returnNotTrue\' method with value \'1\' on \'test.service\' evaluated as invalid.',
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.