public function KeyValueEntityStorageTest::testCreate in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php \Drupal\Tests\Core\Entity\KeyValueStore\KeyValueEntityStorageTest::testCreate()
@covers ::create @covers ::doCreate
Return value
\Drupal\Core\Entity\EntityInterface
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ KeyValueStore/ KeyValueEntityStorageTest.php, line 195 - Contains \Drupal\Tests\Core\Entity\KeyValueStore\KeyValueEntityStorageTest.
Class
- KeyValueEntityStorageTest
- @coversDefaultClass \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage @group Entity
Namespace
Drupal\Tests\Core\Entity\KeyValueStoreCode
public function testCreate() {
$entity = $this
->getMockEntity('Drupal\\Core\\Entity\\Entity', array(), array(
'toArray',
));
$this->entityType
->expects($this
->once())
->method('getClass')
->will($this
->returnValue(get_class($entity)));
$this
->setUpKeyValueEntityStorage();
$this->moduleHandler
->expects($this
->at(0))
->method('invokeAll')
->with('test_entity_type_create');
$this->moduleHandler
->expects($this
->at(1))
->method('invokeAll')
->with('entity_create');
$this->uuidService
->expects($this
->once())
->method('generate')
->will($this
->returnValue('bar'));
$entity = $this->entityStorage
->create(array(
'id' => 'foo',
));
$this
->assertInstanceOf('Drupal\\Core\\Entity\\EntityInterface', $entity);
$this
->assertSame('foo', $entity
->id());
$this
->assertSame('bar', $entity
->uuid());
return $entity;
}