You are here

protected function ContainerBuilderTest::getFakeContainerDefinition 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::getFakeContainerDefinition()

Returns a fake container definition used for testing.

Return value

array The fake container definition with services and parameters.

1 call to ContainerBuilderTest::getFakeContainerDefinition()
ContainerBuilderTest::setUp in tests/src/DependencyInjection/ContainerBuilderTest.php

File

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

Class

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

Namespace

Drupal\Tests\service_container\DependencyInjection

Code

protected function getFakeContainerDefinition() {
  $parameters = array();
  $parameters['some_config'] = 'foo';
  $parameters['some_other_config'] = 'kitten';
  $services = array();
  $services['container'] = array(
    'class' => '\\Drupal\\service_container\\DependencyInjection\\Container',
    'tags' => array(
      array(
        'name' => 'tagged-service',
      ),
    ),
  );
  $services['some_service'] = array(
    'class' => '\\Drupal\\service_container\\Service\\SomeService',
    'arguments' => array(
      '@service_container',
      '%some_config%',
    ),
    'calls' => array(
      array(
        'setContainer',
        array(
          '@service_container',
        ),
      ),
    ),
    'tags' => array(
      array(
        'name' => 'tagged-service',
      ),
      array(
        'name' => 'another-tag',
        'tag-value' => 42,
        'tag-value2' => 23,
      ),
    ),
    'priority' => 0,
  );
  return array(
    'parameters' => $parameters,
    'services' => $services,
  );
}