Creates a typed data object and executes some basic assertions.
Drupal\Core\TypedData\TypedDataManager::create().
protected function createTypedData($definition, $value = NULL, $context = array()) {
// Save the type that was passed in so we can compare with it later.
$type = $definition['type'];
// Construct the object.
$data = typed_data()
->create($definition, $value, $context);
// Assert the definition of the wrapper.
$this
->assertTrue($data instanceof \Drupal\Core\TypedData\TypedDataInterface, 'Typed data object is an instance of the typed data interface.');
$definition = $data
->getDefinition();
$this
->assertTrue(!empty($definition['label']), $definition['label'] . ' data definition was returned.');
// Assert that the correct type was constructed.
$this
->assertEqual($data
->getType(), $type, $definition['label'] . ' object returned type.');
return $data;
}