You are here

public function ContainerTest::testSetContainer in Little helpers 7.2

Test instantiation with parent container.

File

tests/Services/ContainerTest.php, line 163

Class

ContainerTest
Test the service container.

Namespace

Drupal\little_helpers\Services

Code

public function testSetContainer() {
  $container = new Container();
  $container
    ->inject('foo', 'bar');
  $container2 = new Container();
  $container2
    ->setSpecs([
    'queue' => [
      'class' => \SplStack::class,
      'calls' => [
        [
          'push',
          [
            '@foo',
          ],
        ],
      ],
    ],
  ]);
  $container2
    ->setContainer($container);
  $q = $container2
    ->loadService('queue');
  $this
    ->assertEqual('bar', $q
    ->top());
}