Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation.
This commit is contained in:
parent
4afb23bbd3
commit
7784f4c23d
929 changed files with 19798 additions and 5304 deletions
|
@ -821,7 +821,7 @@ abstract class TestBase {
|
|||
* @return bool
|
||||
* TRUE if the assertion succeeded, FALSE otherwise.
|
||||
*
|
||||
* @see TestBase::prepareEnvironment()
|
||||
* @see \Drupal\simpletest\TestBase::prepareEnvironment()
|
||||
* @see \Drupal\Core\DrupalKernel::bootConfiguration()
|
||||
*/
|
||||
protected function assertNoErrorsLogged() {
|
||||
|
@ -830,6 +830,42 @@ abstract class TestBase {
|
|||
return $this->assertFalse(file_exists(DRUPAL_ROOT . '/' . $this->siteDirectory . '/error.log'), 'PHP error.log is empty.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a specific error has been logged to the PHP error log.
|
||||
*
|
||||
* @param string $error_message
|
||||
* The expected error message.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the assertion succeeded, FALSE otherwise.
|
||||
*
|
||||
* @see \Drupal\simpletest\TestBase::prepareEnvironment()
|
||||
* @see \Drupal\Core\DrupalKernel::bootConfiguration()
|
||||
*/
|
||||
protected function assertErrorLogged($error_message) {
|
||||
$error_log_filename = DRUPAL_ROOT . '/' . $this->siteDirectory . '/error.log';
|
||||
if (!file_exists($error_log_filename)) {
|
||||
$this->error('No error logged yet.');
|
||||
}
|
||||
|
||||
$content = file_get_contents($error_log_filename);
|
||||
$rows = explode(PHP_EOL, $content);
|
||||
|
||||
// We iterate over the rows in order to be able to remove the logged error
|
||||
// afterwards.
|
||||
$found = FALSE;
|
||||
foreach ($rows as $row_index => $row) {
|
||||
if (strpos($content, $error_message) !== FALSE) {
|
||||
$found = TRUE;
|
||||
unset($rows[$row_index]);
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents($error_log_filename, implode("\n", $rows));
|
||||
|
||||
return $this->assertTrue($found, sprintf('The %s error message was logged.', $error_message));
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire an assertion that is always positive.
|
||||
*
|
||||
|
|
Reference in a new issue