You are here

public function ConfigEntityStorageTest::testCreate in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreate()

@covers ::create @covers ::doCreate

Return value

\Drupal\Core\Entity\EntityInterface

File

core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php, line 225
Contains \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest.

Class

ConfigEntityStorageTest
@coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityStorage @group Config

Namespace

Drupal\Tests\Core\Config\Entity

Code

public function testCreate() {
  $this->cacheTagsInvalidator
    ->expects($this
    ->never())
    ->method('invalidateTags');
  $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;
}