comparison core/tests/Drupal/Tests/Component/DependencyInjection/PhpArrayContainerTest.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c75dbcec494b
1 <?php
2
3 namespace Drupal\Tests\Component\DependencyInjection;
4
5 use Symfony\Component\DependencyInjection\ContainerInterface;
6
7 /**
8 * @coversDefaultClass \Drupal\Component\DependencyInjection\PhpArrayContainer
9 * @group DependencyInjection
10 */
11 class PhpArrayContainerTest extends ContainerTest {
12
13 /**
14 * {@inheritdoc}
15 */
16 protected function setUp() {
17 $this->machineFormat = FALSE;
18 $this->containerClass = '\Drupal\Component\DependencyInjection\PhpArrayContainer';
19 $this->containerDefinition = $this->getMockContainerDefinition();
20 $this->container = new $this->containerClass($this->containerDefinition);
21 }
22
23 /**
24 * Helper function to return a service definition.
25 */
26 protected function getServiceCall($id, $invalid_behavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
27 if ($invalid_behavior !== ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) {
28 return sprintf('@?%s', $id);
29 }
30
31 return sprintf('@%s', $id);
32 }
33
34 /**
35 * Helper function to return a service definition.
36 */
37 protected function getParameterCall($name) {
38 return '%' . $name . '%';
39 }
40
41 /**
42 * Helper function to return a machine-optimized '@notation'.
43 */
44 protected function getCollection($collection, $resolve = TRUE) {
45 return $collection;
46 }
47
48 }