class PhpArrayContainerTest in Drupal 9
Same name and namespace in other branches
- 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 \PHPUnit\Framework\TestCase uses PhpUnitCompatibilityTrait
- class \Drupal\Tests\Component\DependencyInjection\PhpArrayContainerTest
Expanded class hierarchy of PhpArrayContainerTest
File
- core/
tests/ Drupal/ Tests/ Component/ DependencyInjection/ PhpArrayContainerTest.php, line 11
Namespace
Drupal\Tests\Component\DependencyInjectionView source
class PhpArrayContainerTest extends ContainerTest {
/**
* {@inheritdoc}
*/
protected function setUp() : void {
$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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContainerTest:: |
protected | property | The tested container. | |
ContainerTest:: |
protected | property | The container class to be tested. | |
ContainerTest:: |
protected | property | The container definition used for the test. | |
ContainerTest:: |
protected | property | Whether the container uses the machine-optimized format or not. | |
ContainerTest:: |
protected | function | Gets a mock container definition. | |
ContainerTest:: |
protected | function | Helper function to return a private service definition. | |
ContainerTest:: |
protected | function | Helper function to return a raw value definition. | |
ContainerTest:: |
public | function | Tests that passing a non-supported format throws an InvalidArgumentException. | |
ContainerTest:: |
public | function | Tests that Container::get() works properly. | |
ContainerTest:: |
public | function | Tests that Container::get() for aliased services works properly. | |
ContainerTest:: |
public | function | Tests that Container::get() for circular dependencies works properly. @covers ::get @covers ::createService | |
ContainerTest:: |
public | function | Tests that Container::get() works properly for class from parameters. | |
ContainerTest:: |
public | function | Tests that Container::get() for configurable services works. | |
ContainerTest:: |
public | function | Tests that Container::get() for configurable services throws an Exception. | |
ContainerTest:: |
public | function | Tests that Container::get() for factories via class works (Symfony 2.7.0). | |
ContainerTest:: |
public | function | Tests Container::get() for factories via services (Symfony 2.7.0). | |
ContainerTest:: |
public | function | Tests that Container::get() for various arguments lengths works. | |
ContainerTest:: |
public | function | Tests that Container::get() for NULL service works properly. @covers ::get @covers ::createService | |
ContainerTest:: |
public | function | Tests that Container::get() for non-existent parameters works properly. | |
ContainerTest:: |
public | function | Tests that Container::get() for non-existent parameters works properly. | |
ContainerTest:: |
public | function | Tests that Container::get() for non-existent services works properly. | |
ContainerTest:: |
public | function | Tests that Container::get() for non-existent dependencies works properly. | |
ContainerTest:: |
public | function | Tests that Container::get() for non-existent dependencies works properly. | |
ContainerTest:: |
public | function | Tests multiple Container::get() calls for non-existing dependencies work. | |
ContainerTest:: |
public | function | Tests that Container::get() for non-existent services works properly. | |
ContainerTest:: |
public | function | Tests multiple Container::get() calls with exception on the second time. | |
ContainerTest:: |
public | function | Tests that Container::get() for non-shared services works properly. | |
ContainerTest:: |
public | function | Tests Container::get() with an exception due to missing parameter on the second call. | |
ContainerTest:: |
public | function | Tests that Container::get() for a serialized definition works properly. | |
ContainerTest:: |
public | function | Tests that Container::get() for synthetic services works - if defined. | |
ContainerTest:: |
public | function | Tests that Container::get() for synthetic services throws an Exception if not defined. | |
ContainerTest:: |
public | function | Tests that Container::get() for wrong factories works correctly. | |
ContainerTest:: |
public | function | Tests that Container::getParameter() works properly. | |
ContainerTest:: |
public | function | Tests that Container::getParameter() works properly for non-existing parameters. | |
ContainerTest:: |
public | function | Tests that Container::getParameter() works properly for NULL parameters. | |
ContainerTest:: |
public | function | Tests that Container::getServiceIds() works properly. | |
ContainerTest:: |
public | function | Tests that Container::get() for services with file includes works. | |
ContainerTest:: |
public | function | Tests that Container::has() works properly. | |
ContainerTest:: |
public | function | Tests that Container::has() for aliased services works properly. | |
ContainerTest:: |
public | function | Tests that Container::hasParameter() works properly. | |
ContainerTest:: |
public | function | Tests that Container::initialized works correctly. | |
ContainerTest:: |
public | function | Tests that Container::initialized works correctly for aliases. | |
ContainerTest:: |
public | function | Tests that services with an array of arguments work correctly. | |
ContainerTest:: |
public | function | Tests that an invalid argument throw an Exception. | |
ContainerTest:: |
public | function | Tests that invalid arguments throw an Exception. | |
ContainerTest:: |
public | function | Tests that services that are optional work correctly. | |
ContainerTest:: |
public | function | Tests that private services work correctly. | |
ContainerTest:: |
public | function | Tests that raw type services arguments are resolved correctly. | |
ContainerTest:: |
public | function | Tests that a parameter that points to a service works correctly. | |
ContainerTest:: |
public | function | Tests that private service sharing works correctly. | |
ContainerTest:: |
public | function | Tests that Container::set() works properly. | |
ContainerTest:: |
public | function | Tests that Container::setParameter() in a frozen case works properly. | |
ContainerTest:: |
public | function | Tests that Container::setParameter() in an unfrozen case works properly. | |
PhpArrayContainerTest:: |
protected | function |
Helper function to return a machine-optimized '@notation'. Overrides ContainerTest:: |
|
PhpArrayContainerTest:: |
protected | function |
Helper function to return a service definition. Overrides ContainerTest:: |
|
PhpArrayContainerTest:: |
protected | function |
Helper function to return a service definition. Overrides ContainerTest:: |
|
PhpArrayContainerTest:: |
protected | function |
Overrides ContainerTest:: |