function SystemAuthorizeTest::testError
Same name in other branches
- 10 core/modules/system/tests/src/Functional/System/SystemAuthorizeTest.php \Drupal\Tests\system\Functional\System\SystemAuthorizeTest::testError()
Tests error handling in authorize.php.
File
-
core/
modules/ system/ tests/ src/ Functional/ System/ SystemAuthorizeTest.php, line 74
Class
- SystemAuthorizeTest
- Tests the authorize.php script and related API.
Namespace
Drupal\Tests\system\Functional\SystemCode
public function testError() : void {
$settings_filename = $this->siteDirectory . '/settings.php';
chmod($settings_filename, 0777);
$settings_php = file_get_contents($settings_filename);
$settings_php .= "\ndefine('SIMPLETEST_COLLECT_ERRORS', FALSE);\n";
$settings_php .= "\ntrigger_error('Test warning', E_USER_WARNING);\n";
file_put_contents($settings_filename, $settings_php);
$this->drupalGetAuthorizePHP();
$this->assertSession()
->pageTextContains('User warning: Test warning');
$this->assertSession()
->pageTextMatches('@line \\d+ of sites/simpletest@');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.