function DrupalKernelRequestStackTest::getRequestStackCount
Same name and namespace in other branches
- main core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelRequestStackTest.php \Drupal\KernelTests\Core\DrupalKernel\DrupalKernelRequestStackTest::getRequestStackCount()
Uses reflection to count the number of requests in the request stack.
Parameters
\Symfony\Component\HttpFoundation\RequestStack $request_stack: The request stack.
Return value
int The number of requests in the stack.
2 calls to DrupalKernelRequestStackTest::getRequestStackCount()
- DrupalKernelRequestStackTest::onRequest in core/
tests/ Drupal/ KernelTests/ Core/ DrupalKernel/ DrupalKernelRequestStackTest.php - Records the current request and master request for testing.
- DrupalKernelRequestStackTest::testRequestStackHandling in core/
tests/ Drupal/ KernelTests/ Core/ DrupalKernel/ DrupalKernelRequestStackTest.php - Tests request stack when sub requests are made.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ DrupalKernel/ DrupalKernelRequestStackTest.php, line 195
Class
- DrupalKernelRequestStackTest
- Tests the usage of the request stack as part of request processing.
Namespace
Drupal\KernelTests\Core\DrupalKernelCode
private function getRequestStackCount(RequestStack $request_stack) : int {
// Create reflection object
$reflection = new \ReflectionClass($request_stack);
// Get the private property
return count($reflection->getProperty('requests')
->getValue($request_stack));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.