/**
* Tests deriving metadata about list items.
*/
public function testLists() { $list_definition = ListDataDefinition::
create('string'
);
$this->
assertInstanceOf(ListDataDefinitionInterface::
class,
$list_definition);
$item_definition =
$list_definition->
getItemDefinition();
$this->
assertInstanceOf(DataDefinitionInterface::
class,
$item_definition);
$this->
assertEquals('string',
$item_definition->
getDataType());
// Test using the definition factory.
$list_definition2 =
$this->typedDataManager->
createListDataDefinition('string'
);
$this->
assertInstanceOf(ListDataDefinitionInterface::
class,
$list_definition2);
$this->
assertEquals($list_definition,
$list_definition2);
// Test creating the definition of data with type 'list', which is the same
// as creating a definition of a list of items of type 'any'.
$list_definition =
$this->typedDataManager->
createDataDefinition('list'
);
$this->
assertInstanceOf(ListDataDefinitionInterface::
class,
$list_definition);
$this->
assertEquals('list',
$list_definition->
getDataType());
$this->
assertEquals('any',
$list_definition->
getItemDefinition()->
getDataType());
}