You are here

public function ContainerBuilderTest::test_getContainerDefinition in Service Container 7

Same name and namespace in other branches
  1. 7.2 tests/src/DependencyInjection/ContainerBuilderTest.php \Drupal\Tests\service_container\DependencyInjection\ContainerBuilderTest::test_getContainerDefinition()

@covers ::__construct() @covers ::getContainerDefinition()

File

tests/src/DependencyInjection/ContainerBuilderTest.php, line 82
Contains \Drupal\Tests\service_container\DependencyInjection\ContainerBuilderTest

Class

ContainerBuilderTest
@coversDefaultClass \Drupal\service_container\DependencyInjection\ContainerBuilder @group dic

Namespace

Drupal\Tests\service_container\DependencyInjection

Code

public function test_getContainerDefinition() {

  // We need to use a partial mock as the alter method calls procedural code.
  $container_builder = Mockery::mock('\\Drupal\\service_container\\DependencyInjection\\ContainerBuilder[moduleAlter]', array(
    $this->serviceProviderManager,
  ));
  $container_builder
    ->shouldAllowMockingProtectedMethods();
  $container_builder
    ->shouldReceive('moduleAlter')
    ->once();
  $definition = $container_builder
    ->getContainerDefinition();
  $this
    ->assertEquals($definition, $this->alteredDefinition, 'Definition of the container matches.');
}