public function ContainerTest::testLoadWithVariables in Little helpers 7.2
Test passing config variables as arguments.
File
- tests/
Services/ ContainerTest.php, line 146
Class
- ContainerTest
- Test the service container.
Namespace
Drupal\little_helpers\ServicesCode
public function testLoadWithVariables() {
$container = new Container();
$container
->setSpecs([
'fixed_array' => [
'class' => \SplFixedArray::class,
'constructor' => 'fromArray',
'arguments' => [
'!initial',
],
],
]);
$GLOBALS['conf']['initial'] = [
1,
2,
3,
];
$a = $container
->getSpec('fixed_array')
->instantiate();
$this
->assertEqual([
1,
2,
3,
], $a
->toArray());
}