class TestClass in Drupal 10
Same name in this branch
- 10 core/tests/Drupal/Tests/Core/Test/AssertContentTraitTest.php \Drupal\Tests\Core\Test\TestClass
- 10 core/tests/Drupal/Tests/Core/Plugin/PluginWithFormsTraitTest.php \Drupal\Tests\Core\Plugin\TestClass
- 10 core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php \Drupal\Tests\Core\TypedData\TestClass
- 10 core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php \Drupal\Tests\Component\Utility\TestClass
- 10 core/modules/layout_builder/tests/src/Unit/LayoutEntityHelperTraitTest.php \Drupal\Tests\layout_builder\Unit\TestClass
- 10 core/modules/system/tests/modules/service_provider_test/src/TestClass.php \Drupal\service_provider_test\TestClass
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/service_provider_test/src/TestClass.php \Drupal\service_provider_test\TestClass
- 9 core/modules/system/tests/modules/service_provider_test/src/TestClass.php \Drupal\service_provider_test\TestClass
Hierarchy
- class \Drupal\service_provider_test\TestClass implements \Symfony\Component\EventDispatcher\EventSubscriberInterface, \Symfony\Component\DependencyInjection\ContainerAwareInterface, DestructableInterface uses \Symfony\Component\DependencyInjection\ContainerAwareTrait
Expanded class hierarchy of TestClass
5 string references to 'TestClass'
- AuthenticationProviderPassTest::testEncoders in core/
tests/ Drupal/ Tests/ Core/ DependencyInjection/ Compiler/ AuthenticationProviderPassTest.php - @covers ::process
- ErrorTest::providerTestFormatBacktrace in core/
tests/ Drupal/ Tests/ Core/ Utility/ ErrorTest.php - Data provider for testFormatBacktrace.
- ErrorTest::providerTestGetLastCaller in core/
tests/ Drupal/ Tests/ Core/ Utility/ ErrorTest.php - Data provider for testGetLastCaller.
- RegisterSerializationClassesCompilerPassTest::testEncoders in core/
modules/ serialization/ tests/ src/ Unit/ CompilerPass/ RegisterSerializationClassesCompilerPassTest.php - @covers ::process
- service_provider_test.services.yml in core/
modules/ system/ tests/ modules/ service_provider_test/ service_provider_test.services.yml - core/modules/system/tests/modules/service_provider_test/service_provider_test.services.yml
1 service uses TestClass
- service_provider_test_class in core/
modules/ system/ tests/ modules/ service_provider_test/ service_provider_test.services.yml - Drupal\service_provider_test\TestClass
File
- core/
modules/ system/ tests/ modules/ service_provider_test/ src/ TestClass.php, line 14
Namespace
Drupal\service_provider_testView source
class TestClass implements EventSubscriberInterface, DestructableInterface, ContainerAwareInterface {
use ContainerAwareTrait;
/**
* The state keyvalue collection.
*
* @var \Drupal\Core\State\StateInterface
*/
protected $state;
/**
* Constructor.
*
* @param \Drupal\Core\State\StateInterface $state
* The state key value store.
*/
public function __construct(StateInterface $state) {
$this->state = $state;
}
/**
* A simple kernel listener method.
*/
public function onKernelRequestTest(RequestEvent $event) {
\Drupal::messenger()
->addStatus(t('The service_provider_test event subscriber fired!'));
}
/**
* Flags the response in case a rebuild indicator is used.
*/
public function onKernelResponseTest(ResponseEvent $event) {
if ($this->container
->hasParameter('container_rebuild_indicator')) {
$event
->getResponse()->headers
->set('container_rebuild_indicator', $this->container
->getParameter('container_rebuild_indicator'));
}
if ($this->container
->hasParameter('container_rebuild_test_parameter')) {
$event
->getResponse()->headers
->set('container_rebuild_test_parameter', $this->container
->getParameter('container_rebuild_test_parameter'));
}
}
/**
* Registers methods as kernel listeners.
*
* @return array
* An array of event listener definitions.
*/
public static function getSubscribedEvents() : array {
$events[KernelEvents::REQUEST][] = [
'onKernelRequestTest',
];
$events[KernelEvents::RESPONSE][] = [
'onKernelResponseTest',
];
return $events;
}
/**
* {@inheritdoc}
*/
public function destruct() {
$this->state
->set('service_provider_test.destructed', TRUE);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TestClass:: |
protected | property | The state keyvalue collection. | |
TestClass:: |
public | function |
Performs destruct operations. Overrides DestructableInterface:: |
|
TestClass:: |
public static | function | Registers methods as kernel listeners. | |
TestClass:: |
public | function | A simple kernel listener method. | |
TestClass:: |
public | function | Flags the response in case a rebuild indicator is used. | |
TestClass:: |
public | function | Constructor. |