public function ContainerTest::testSetSpecsOverwrites in Little helpers 7.2
Test that new specs overwrite old specs.
File
- tests/
Services/ ContainerTest.php, line 183
Class
- ContainerTest
- Test the service container.
Namespace
Drupal\little_helpers\ServicesCode
public function testSetSpecsOverwrites() {
$container = new Container();
$specs1['x'] = [
'class' => \SplStack::class,
'calls' => [
[
'push',
[
'foo',
],
],
],
];
$specs1['y'] = [
'class' => \SplStack::class,
'calls' => [
[
'push',
[
'baz',
],
],
],
];
$container
->setSpecs($specs1);
$specs2['x'] = [
'class' => \SplStack::class,
'calls' => [
[
'push',
[
'bar',
],
],
],
];
$container
->setSpecs($specs2);
$this
->assertEqual('bar', $container
->loadService('x')
->top());
$this
->assertEqual('baz', $container
->loadService('y')
->top());
}