You are here

public function ContainerTest::testCalls in Little helpers 7.2

Test a constructor method spec.

File

tests/Services/ContainerTest.php, line 56

Class

ContainerTest
Test the service container.

Namespace

Drupal\little_helpers\Services

Code

public function testCalls() {
  $specs['a'] = [
    'class' => \SplFixedArray::class,
    'arguments' => [
      2,
    ],
    'calls' => [
      [
        'offsetSet',
        [
          0,
          1,
        ],
      ],
      [
        'offsetSet',
        [
          1,
          2,
        ],
      ],
    ],
  ];
  $container = new Container();
  $container
    ->setSpecs($specs);
  $a = $container
    ->loadService('a');
  $this
    ->assertEqual([
    1,
    2,
  ], $a
    ->toArray());
}