You are here

public function ContainerTest::test_hasDefinition in Service Container 7.2

Same name and namespace in other branches
  1. 7 tests/src/DependencyInjection/ContainerTest.php \Drupal\Tests\service_container\DependencyInjection\ContainerTest::test_hasDefinition()

Tests that Container::hasDefinition() works properly. @covers ::hasDefinition()

File

tests/src/DependencyInjection/ContainerTest.php, line 44
Contains \Drupal\Tests\service_container\DependencyInjection\ContainerTest

Class

ContainerTest
@coversDefaultClass \Drupal\service_container\DependencyInjection\Container @group dic

Namespace

Drupal\Tests\service_container\DependencyInjection

Code

public function test_hasDefinition() {
  $this
    ->assertEquals($this->container
    ->hasDefinition('service_container'), TRUE, 'Container has definition of itself.');
  $this
    ->assertEquals($this->container
    ->hasDefinition('service.does_not_exist'), FALSE, 'Container does not have non-existent service.');
  $this
    ->assertEquals($this->container
    ->hasDefinition('service.provider'), TRUE, 'Container has service.provider service.');
}