class LegacyFrontControllerTest
Same name and namespace in other branches
- main core/tests/Drupal/FunctionalTests/Bootstrap/LegacyFrontControllerTest.php \Drupal\FunctionalTests\Bootstrap\LegacyFrontControllerTest
Tests that front-controllers without symfony/runtime keep working.
Symfony Runtime is introduced to change bootstrap logic. This should be done as a backward-compatible change. This test ensures that applications that still use the old model of index.php (initializing the DrupalKernel, creating the request, and dispatching it) will keep working.
Attributes
#[Group('browsertestbase')]
#[RunTestsInSeparateProcesses]
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Tests\DrupalTestCaseTrait, \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalTests\Bootstrap\LegacyFrontControllerTest extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of LegacyFrontControllerTest
File
-
core/
tests/ Drupal/ FunctionalTests/ Bootstrap/ LegacyFrontControllerTest.php, line 21
Namespace
Drupal\FunctionalTests\BootstrapView source
class LegacyFrontControllerTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'legacy_front_controller_test',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* The file system under test.
*/
protected FileSystemInterface $fileSystem;
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->fileSystem = $this->container
->get('file_system');
}
/**
* Tests that a simple request is routed by the front-controller correctly.
*/
public function testSuccessfulFrontControllerRequest() : void {
$module_path = $this->getModulePath('legacy_front_controller_test');
$this->fileSystem
->copy($module_path . "/test_index.php.template", $module_path . "/test_index.php", FileExists::Replace);
try {
$this->drupalGet("{$this->baseUrl}/core/modules/system/tests/modules/legacy_front_controller_test/test_index.php/test");
} finally {
$this->fileSystem
->delete($module_path . "/test_index.php");
}
$this->assertSession()
->pageTextContains('Hello World');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.