function TestSiteApplicationTest::testInstallInDifferentLanguage
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php \Drupal\Tests\Scripts\TestSiteApplicationTest::testInstallInDifferentLanguage()
- 10 core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php \Drupal\Tests\Scripts\TestSiteApplicationTest::testInstallInDifferentLanguage()
- 11.x core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php \Drupal\Tests\Scripts\TestSiteApplicationTest::testInstallInDifferentLanguage()
@coversNothing
File
-
core/
tests/ Drupal/ Tests/ Scripts/ TestSiteApplicationTest.php, line 202
Class
- TestSiteApplicationTest
- Tests core/scripts/test-site.php.
Namespace
Drupal\Tests\ScriptsCode
public function testInstallInDifferentLanguage() {
$simpletest_path = $this->root . DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR . 'simpletest';
if (!is_writable($simpletest_path)) {
$this->markTestSkipped("Requires the directory {$simpletest_path} to exist and be writable");
}
$command_line = $this->php . ' core/scripts/test-site.php install --json --langcode fr --setup-file core/tests/Drupal/TestSite/TestSiteMultilingualInstallTestScript.php --db-url "' . getenv('SIMPLETEST_DB') . '"';
$process = Process::fromShellCommandline($command_line, $this->root);
$process->setTimeout(500);
$process->run();
$this->assertEquals(0, $process->getExitCode());
$result = json_decode($process->getOutput(), TRUE);
$db_prefix = $result['db_prefix'];
$http_client = new Client();
$request = (new Request('GET', getenv('SIMPLETEST_BASE_URL') . '/test-page'))->withHeader('User-Agent', trim($result['user_agent']));
$response = $http_client->send($request);
// Ensure the test_page_test module got installed.
$this->assertStringContainsString('Test page | Drupal', (string) $response->getBody());
$this->assertStringContainsString('lang="fr"', (string) $response->getBody());
// Now test the tear down process as well.
$command_line = $this->php . ' core/scripts/test-site.php tear-down ' . $db_prefix . ' --db-url "' . getenv('SIMPLETEST_DB') . '"';
$process = Process::fromShellCommandline($command_line, $this->root);
$process->setTimeout(500);
$process->run();
$this->assertSame(0, $process->getExitCode());
// Ensure that all the tables for this DB prefix are gone.
$this->assertCount(0, Database::getConnection('default', $this->addTestDatabase($db_prefix))
->schema()
->findTables('%'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.