You are here

protected function CachedContainerBuilderTest::getFakeContainerDefinition in Service Container 7

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

Returns a fake container definition used for testing.

Return value

array The fake container definition with services and parameters.

4 calls to CachedContainerBuilderTest::getFakeContainerDefinition()
CachedContainerBuilderTest::getCachedContainerBuilderMock in tests/src/DependencyInjection/CachedContainerBuilderTest.php
CachedContainerBuilderTest::test_getContainerDefinition in tests/src/DependencyInjection/CachedContainerBuilderTest.php
Tests that CachedContainerBuilder::getContainerDefinition() works properly. @covers ::getContainerDefinition() @covers ::getCache() @covers ::setCache()
CachedContainerBuilderTest::test_isCached_getContainerDefinition in tests/src/DependencyInjection/CachedContainerBuilderTest.php
@covers ::isCached() @covers ::getContainerDefinition() @covers ::getCache() @covers ::setCache()
CachedContainerBuilderTest::test_reset in tests/src/DependencyInjection/CachedContainerBuilderTest.php
@covers ::reset()

File

tests/src/DependencyInjection/CachedContainerBuilderTest.php, line 164
Contains \Drupal\Tests\service_container\DependencyInjection\CachedContainerBuilderTest

Class

CachedContainerBuilderTest
@coversDefaultClass \Drupal\service_container\DependencyInjection\CachedContainerBuilder @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(
        '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(
        'tagged-service',
      ),
      array(
        'another-tag',
        array(
          'tag-value' => 42,
          'tag-value2' => 23,
        ),
      ),
    ),
    'priority' => 0,
  );
  return array(
    'parameters' => $parameters,
    'services' => $services,
  );
}