class InstallerRouterTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/FunctionalTests/Installer/InstallerRouterTest.php \Drupal\FunctionalTests\Installer\InstallerRouterTest
- 10 core/tests/Drupal/FunctionalTests/Installer/InstallerRouterTest.php \Drupal\FunctionalTests\Installer\InstallerRouterTest
Tests router rebuilding during installation.
@group Installer
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \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\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalTests\Installer\InstallerTestBase uses \Drupal\Tests\RequirementsPageTrait extends \Drupal\Tests\BrowserTestBase
- class \Drupal\FunctionalTests\Installer\InstallerRouterTest extends \Drupal\FunctionalTests\Installer\InstallerTestBase
- class \Drupal\FunctionalTests\Installer\InstallerTestBase uses \Drupal\Tests\RequirementsPageTrait extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of InstallerRouterTest
File
-
core/
tests/ Drupal/ FunctionalTests/ Installer/ InstallerRouterTest.php, line 14
Namespace
Drupal\FunctionalTests\InstallerView source
class InstallerRouterTest extends InstallerTestBase {
/**
* {@inheritdoc}
*/
protected $profile = 'test_profile';
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function prepareEnvironment() {
parent::prepareEnvironment();
$info = [
'type' => 'profile',
'core_version_requirement' => '*',
'name' => 'Router testing profile',
'install' => [
'router_test',
'router_installer_test',
],
];
// File API functions are not available yet.
$path = $this->siteDirectory . '/profiles/test_profile';
mkdir($path, 0777, TRUE);
file_put_contents("{$path}/test_profile.info.yml", Yaml::encode($info));
$settings_services_file = DRUPAL_ROOT . '/sites/default/default.services.yml';
copy($settings_services_file, $this->siteDirectory . '/services.yml');
PerformanceTestRecorder::registerService($this->siteDirectory . '/services.yml', TRUE);
}
/**
* Confirms that the installation succeeded.
*/
public function testInstalled() {
$this->assertSession()
->statusCodeEquals(200);
// Ensures that router is not rebuilt unnecessarily during the install. It
// is rebuilt during:
// - router_test_install()
// - router_installer_test_modules_installed()
// - install_finished()
$this->assertSame(3, \Drupal::service('core.performance.test.recorder')->getCount('event', RoutingEvents::FINISHED));
$this->assertStringEndsWith('/core/install.php/router_installer_test/test1', \Drupal::state()->get('router_installer_test_modules_installed'));
$this->assertStringEndsWith('/core/install.php/router_test/test1', \Drupal::state()->get('router_test_install'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.