Mercurial > hg > cmmr2012-drupal-site
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/tests/Drupal/Tests/Component/DependencyInjection/PhpArrayContainerTest.php Thu Jul 05 14:24:15 2018 +0000 @@ -0,0 +1,48 @@ +<?php + +namespace Drupal\Tests\Component\DependencyInjection; + +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** + * @coversDefaultClass \Drupal\Component\DependencyInjection\PhpArrayContainer + * @group DependencyInjection + */ +class PhpArrayContainerTest extends ContainerTest { + + /** + * {@inheritdoc} + */ + protected function setUp() { + $this->machineFormat = FALSE; + $this->containerClass = '\Drupal\Component\DependencyInjection\PhpArrayContainer'; + $this->containerDefinition = $this->getMockContainerDefinition(); + $this->container = new $this->containerClass($this->containerDefinition); + } + + /** + * Helper function to return a service definition. + */ + protected function getServiceCall($id, $invalid_behavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) { + if ($invalid_behavior !== ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) { + return sprintf('@?%s', $id); + } + + return sprintf('@%s', $id); + } + + /** + * Helper function to return a service definition. + */ + protected function getParameterCall($name) { + return '%' . $name . '%'; + } + + /** + * Helper function to return a machine-optimized '@notation'. + */ + protected function getCollection($collection, $resolve = TRUE) { + return $collection; + } + +}