You are here

public function ContainerTest::testConstructorMethod in Little helpers 7.2

Test a constructor method spec.

File

tests/Services/ContainerTest.php, line 41

Class

ContainerTest
Test the service container.

Namespace

Drupal\little_helpers\Services

Code

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