public function EntityManagerTest::testMethods

Tests some methods on the manager.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Entity/EntityManagerTest.php, line 28
Contains \Drupal\system\Tests\Entity\EntityManagerTest.

Class

EntityManagerTest
Tests methods on the entity manager.

Namespace

Drupal\system\Tests\Entity

Code

public function testMethods() {

  // Tests the has controller method.
  $entity_manager = $this->container
    ->get('plugin.manager.entity');
  $this
    ->assertFalse($entity_manager
    ->hasController('non_existent', 'storage'), 'A non existent entity type has no controller.');
  $this
    ->assertFalse($entity_manager
    ->hasController('non_existent', 'non_existent'), 'A non existent entity type has no controller.');
  $this
    ->assertFalse($entity_manager
    ->hasController('entity_test', 'non_existent'), 'An existent entity type does not have a non existent controller.');
  $this
    ->assertFalse($entity_manager
    ->hasController('entity_test', 'render'), 'The test entity does not have specified the render controller.');
  $this
    ->assertTrue($entity_manager
    ->hasController('entity_test', 'storage'), 'The test entity has specified the controller class');
}