You are here

class PhpArrayContainerTest in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/DependencyInjection/PhpArrayContainerTest.php \Drupal\Tests\Component\DependencyInjection\PhpArrayContainerTest

@coversDefaultClass \Drupal\Component\DependencyInjection\PhpArrayContainer @group DependencyInjection

Hierarchy

  • class \Drupal\Tests\Component\DependencyInjection\ContainerTest extends \Drupal\Tests\Component\DependencyInjection\PHPUnit_Framework_TestCase

Expanded class hierarchy of PhpArrayContainerTest

File

core/tests/Drupal/Tests/Component/DependencyInjection/PhpArrayContainerTest.php, line 16
Contains \Drupal\Tests\Component\DependencyInjection\PhpArrayContainerTest.

Namespace

Drupal\Tests\Component\DependencyInjection
View source
class PhpArrayContainerTest extends ContainerTest {

  /**
   * {@inheritdoc}
   */
  public 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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContainerTest::$container protected property The tested container.
ContainerTest::$containerClass protected property The container class to be tested.
ContainerTest::$containerDefinition protected property The container definition used for the test.
ContainerTest::$machineFormat protected property Whether the container uses the machine-optimized format or not.
ContainerTest::getMockContainerDefinition protected function Gets a mock container definition.
ContainerTest::getPrivateServiceCall protected function Helper function to return a private service definition.
ContainerTest::scopeExceptionTestProvider public function Data provider for scopeExceptionTestProvider().
ContainerTest::testConstruct public function Tests that passing a non-supported format throws an InvalidArgumentException.
ContainerTest::testGet public function Tests that Container::get() works properly.
ContainerTest::testGetForAliasedService public function Tests that Container::get() for aliased services works properly.
ContainerTest::testGetForCircularServices public function Tests that Container::get() for circular dependencies works properly. @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException @covers ::get @covers ::createService
ContainerTest::testGetForClassFromParameter public function Tests that Container::get() works properly for class from parameters.
ContainerTest::testGetForConfigurator public function Tests that Container::get() for configurable services works.
ContainerTest::testGetForConfiguratorWithException public function Tests that Container::get() for configurable services throws an Exception.
ContainerTest::testGetForFactoryClass public function Tests that Container::get() for factories via class works (Symfony 2.7.0).
ContainerTest::testGetForFactoryService public function Tests Container::get() for factories via services (Symfony 2.7.0).
ContainerTest::testGetForInstantiationWithVariousArgumentLengths public function Tests that Container::get() for various arguments lengths works.
ContainerTest::testGetForNonExistantNULLService public function Tests that Container::get() for NULL service works properly. @covers ::get @covers ::createService
ContainerTest::testGetForNonExistantParameterDependency public function Tests that Container::get() for non-existent parameters works properly.
ContainerTest::testGetForNonExistantParameterDependencyWithException public function Tests that Container::get() for non-existent parameters works properly.
ContainerTest::testGetForNonExistantService public function Tests that Container::get() for non-existent services works properly.
ContainerTest::testGetForNonExistantServiceDependency public function Tests that Container::get() for non-existent dependencies works properly.
ContainerTest::testGetForNonExistantServiceDependencyWithException public function Tests that Container::get() for non-existent dependencies works properly.
ContainerTest::testGetForNonExistantServiceMultipleTimes public function Tests multiple Container::get() calls for non-existing dependencies work.
ContainerTest::testGetForNonExistantServiceWhenUsingNull public function Tests that Container::get() for non-existent services works properly.
ContainerTest::testGetForNonExistantServiceWithExceptionOnSecondCall public function Tests multiple Container::get() calls with exception on the second time.
ContainerTest::testGetForNonSharedService public function Tests that Container::get() for non-shared services works properly.
ContainerTest::testGetForParameterDependencyWithExceptionOnSecondCall public function Tests Container::get() with an exception due to missing parameter on the second call.
ContainerTest::testGetForSerializedServiceDefinition public function Tests that Container::get() for a serialized definition works properly.
ContainerTest::testGetForSyntheticService public function Tests that Container::get() for synthetic services works - if defined.
ContainerTest::testGetForSyntheticServiceWithException public function Tests that Container::get() for synthetic services throws an Exception if not defined.
ContainerTest::testGetForWrongFactory public function Tests that Container::get() for wrong factories works correctly.
ContainerTest::testGetParameter public function Tests that Container::getParameter() works properly.
ContainerTest::testGetParameterIfNotFound public function Tests that Container::getParameter() works properly for non-existing parameters.
ContainerTest::testGetParameterIfNotFoundBecauseNull public function Tests that Container::getParameter() works properly for NULL parameters.
ContainerTest::testGetServiceIds public function Tests that Container::getServiceIds() works properly.
ContainerTest::testGetWithFileInclude public function Tests that Container::get() for services with file includes works.
ContainerTest::testHas public function Tests that Container::has() works properly.
ContainerTest::testHasParameter public function Tests that Container::hasParameter() works properly.
ContainerTest::testInitialized public function Tests that Container::initialized works correctly.
ContainerTest::testInitializedForAliases public function Tests that Container::initialized works correctly for aliases.
ContainerTest::testResolveServicesAndParametersForArgumentsUsingDeepArray public function Tests that services with an array of arguments work correctly.
ContainerTest::testResolveServicesAndParametersForInvalidArgument public function Tests that an invalid argument throw an Exception.
ContainerTest::testResolveServicesAndParametersForInvalidArguments public function Tests that invalid arguments throw an Exception.
ContainerTest::testResolveServicesAndParametersForOptionalServiceDependencies public function Tests that services that are optional work correctly.
ContainerTest::testResolveServicesAndParametersForPrivateService public function Tests that private services work correctly.
ContainerTest::testResolveServicesAndParametersForServiceInstantiatedFromParameter public function Tests that a parameter that points to a service works correctly.
ContainerTest::testResolveServicesAndParametersForSharedPrivateService public function Tests that private service sharing works correctly.
ContainerTest::testScopeFunctionsWithException public function Tests that unsupported methods throw an Exception.
ContainerTest::testSet public function Tests that Container::set() works properly.
ContainerTest::testSetParameterWithFrozenContainer public function Tests that Container::setParameter() in a frozen case works properly.
ContainerTest::testSetParameterWithUnfrozenContainer public function Tests that Container::setParameter() in an unfrozen case works properly.
PhpArrayContainerTest::getCollection protected function Helper function to return a machine-optimized '@notation'. Overrides ContainerTest::getCollection
PhpArrayContainerTest::getParameterCall protected function Helper function to return a service definition. Overrides ContainerTest::getParameterCall
PhpArrayContainerTest::getServiceCall protected function Helper function to return a service definition. Overrides ContainerTest::getServiceCall
PhpArrayContainerTest::setUp public function Overrides ContainerTest::setUp