protected function TypedDataTest::createTypedData in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/TypedData/TypedDataTest.php \Drupal\system\Tests\TypedData\TypedDataTest::createTypedData()
Creates a typed data object and ensures it implements TypedDataInterface.
See also
\Drupal\Core\TypedData\TypedDataManager::create().
4 calls to TypedDataTest::createTypedData()
- TypedDataTest::testGetAndSet in core/
modules/ system/ src/ Tests/ TypedData/ TypedDataTest.php - Tests the basics around constructing and working with typed data objects.
- TypedDataTest::testTypedDataLists in core/
modules/ system/ src/ Tests/ TypedData/ TypedDataTest.php - Tests using typed data lists.
- TypedDataTest::testTypedDataListsFilter in core/
modules/ system/ src/ Tests/ TypedData/ TypedDataTest.php - Tests the filter() method on typed data lists.
- TypedDataTest::testTypedDataMaps in core/
modules/ system/ src/ Tests/ TypedData/ TypedDataTest.php - Tests using a typed data map.
File
- core/
modules/ system/ src/ Tests/ TypedData/ TypedDataTest.php, line 51 - Contains \Drupal\system\Tests\TypedData\TypedDataTest.
Class
- TypedDataTest
- Tests the functionality of all core data types.
Namespace
Drupal\system\Tests\TypedDataCode
protected function createTypedData($definition, $value = NULL, $name = NULL) {
if (is_array($definition)) {
$definition = DataDefinition::create($definition['type']);
}
$data = $this->typedDataManager
->create($definition, $value, $name);
$this
->assertTrue($data instanceof \Drupal\Core\TypedData\TypedDataInterface, 'Typed data object is an instance of the typed data interface.');
return $data;
}