public function ContainerTest::testLoadWithKwargs in Little helpers 7.2
Test getSpec() and instantiate() with keyword arguments.
File
- tests/
Services/ ContainerTest.php, line 130
Class
- ContainerTest
- Test the service container.
Namespace
Drupal\little_helpers\ServicesCode
public function testLoadWithKwargs() {
$container = new Container();
$container
->setSpecs([
'fixed_array' => [
'class' => \SplFixedArray::class,
'constructor' => 'fromArray',
'arguments' => [
'%initial',
],
],
]);
$a = $container
->getSpec('fixed_array')
->instantiate([
'initial' => [
1,
2,
3,
],
]);
$this
->assertEqual([
1,
2,
3,
], $a
->toArray());
}