function RecursiveContextualValidatorTest::buildExampleTypedDataWithProperties
Same name and namespace in other branches
- 10 core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php \Drupal\Tests\Core\TypedData\RecursiveContextualValidatorTest::buildExampleTypedDataWithProperties()
- 9 core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php \Drupal\Tests\Core\TypedData\RecursiveContextualValidatorTest::buildExampleTypedDataWithProperties()
- 8.9.x core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php \Drupal\Tests\Core\TypedData\RecursiveContextualValidatorTest::buildExampleTypedDataWithProperties()
Builds some example type data object.
Return value
\Drupal\Core\TypedData\TypedDataInterface|\PHPUnit\Framework\MockObject\MockObject A typed data object with nested properties for testing purposes.
3 calls to RecursiveContextualValidatorTest::buildExampleTypedDataWithProperties()
- RecursiveContextualValidatorTest::testPropertiesValidateWithMultipleLevels in core/
tests/ Drupal/ Tests/ Core/ TypedData/ RecursiveContextualValidatorTest.php - Tests properties validate with multiple levels.
- RecursiveContextualValidatorTest::testValidateProperty in core/
tests/ Drupal/ Tests/ Core/ TypedData/ RecursiveContextualValidatorTest.php - Tests validate property.
- RecursiveContextualValidatorTest::testValidatePropertyValue in core/
tests/ Drupal/ Tests/ Core/ TypedData/ RecursiveContextualValidatorTest.php - Tests validate property value.
File
-
core/
tests/ Drupal/ Tests/ Core/ TypedData/ RecursiveContextualValidatorTest.php, line 337
Class
- RecursiveContextualValidatorTest
- Tests Drupal\Core\TypedData\Validation\RecursiveContextualValidator.
Namespace
Drupal\Tests\Core\TypedDataCode
protected function buildExampleTypedDataWithProperties($subkey_value = NULL) {
$subkey_value = $subkey_value ?: [
'subkey1' => 'subvalue1',
'subkey2' => 'subvalue2',
];
$tree = [
'value' => [
'key1' => 'value1',
'key2' => 'value2',
'key_with_properties' => $subkey_value,
],
];
$tree['properties'] = [
'key1' => [
'value' => 'value1',
],
'key2' => [
'value' => 'value2',
],
'key_with_properties' => [
'value' => $subkey_value ?: [
'subkey1' => 'subvalue1',
'subkey2' => 'subvalue2',
],
],
];
$tree['properties']['key_with_properties']['properties']['subkey1'] = [
'value' => $tree['properties']['key_with_properties']['value']['subkey1'],
];
$tree['properties']['key_with_properties']['properties']['subkey2'] = [
'value' => $tree['properties']['key_with_properties']['value']['subkey2'],
];
return $this->setupTypedData($tree, 'test_name');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.