public function KeyValueEntityStorageTest::testLoad in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php \Drupal\Tests\Core\Entity\KeyValueStore\KeyValueEntityStorageTest::testLoad()
@covers ::load @covers ::postLoad
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ KeyValueStore/ KeyValueEntityStorageTest.php, line 490 - 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 testLoad() {
$entity = $this
->getMockEntity();
$this->entityType
->expects($this
->once())
->method('getClass')
->will($this
->returnValue(get_class($entity)));
$this
->setUpKeyValueEntityStorage();
$this->keyValueStore
->expects($this
->once())
->method('getMultiple')
->with(array(
'foo',
))
->will($this
->returnValue(array(
array(
'id' => 'foo',
),
)));
$this->moduleHandler
->expects($this
->at(0))
->method('getImplementations')
->with('entity_load')
->will($this
->returnValue(array()));
$this->moduleHandler
->expects($this
->at(1))
->method('getImplementations')
->with('test_entity_type_load')
->will($this
->returnValue(array()));
$entity = $this->entityStorage
->load('foo');
$this
->assertInstanceOf('Drupal\\Core\\Entity\\EntityInterface', $entity);
$this
->assertSame('foo', $entity
->id());
}