You are here

public function ContainerAwarePluginManagerTest::test_getInstance in Service Container 7.2

Same name and namespace in other branches
  1. 7 tests/src/Plugin/ContainerAwarePluginManagerTest.php \Drupal\Tests\service_container\Plugin\ContainerAwarePluginManagerTest::test_getInstance()

@covers ::getInstance()

File

tests/src/Plugin/ContainerAwarePluginManagerTest.php, line 67
Contains \Drupal\Tests\service_container\Plugin\ContainerAwarePluginManagerTest

Class

ContainerAwarePluginManagerTest
@coversDefaultClass \Drupal\service_container\Plugin\ContainerAwarePluginManager @group dic

Namespace

Drupal\Tests\service_container\Plugin

Code

public function test_getInstance() {
  $block_controller = $this->controllerPluginManager
    ->getInstance(array(
    'id' => 'block',
  ));
  $this
    ->assertInstanceof('\\Drupal\\render_cache_block\\RenderCache\\Controller\\BlockController', $block_controller, 'getInstance() returns the right class.');
  $block_controller2 = $this->controllerPluginManager
    ->getInstance(array());
  $this
    ->assertFalse($block_controller2, 'getInstance() returns the null, when definition not specified.');
}