You are here

public function SpecTest::testKwargs in Little helpers 7.2

Test passing keyword arguments in the spec.

File

tests/Services/SpecTest.php, line 15

Class

SpecTest
Test the instantiating spec class.

Namespace

Drupal\little_helpers\Services

Code

public function testKwargs() {
  $spec = Spec::fromInfo([
    'class' => \SplFixedArray::class,
    'constructor' => 'fromArray',
    'arguments' => [
      '%initial',
    ],
    'calls' => [
      [
        'offsetSet',
        [
          0,
          '%other',
        ],
      ],
    ],
  ]);
  $this
    ->assertEqual([
    0,
    2,
    3,
  ], $spec
    ->instantiate([
    'initial' => [
      1,
      2,
      3,
    ],
    'other' => 0,
  ])
    ->toArray());
}