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
|
@ -170,17 +170,20 @@ function simpletest_run_tests($test_list) {
|
|||
* @param $unescaped_test_classnames
|
||||
* An array of test class names, including full namespaces, to be passed as
|
||||
* a regular expression to PHPUnit's --filter option.
|
||||
* @param int $status
|
||||
* (optional) The exit status code of the PHPUnit process will be assigned to
|
||||
* this variable.
|
||||
*
|
||||
* @return array
|
||||
* The parsed results of PHPUnit's JUnit XML output, in the format of
|
||||
* {simpletest}'s schema.
|
||||
*/
|
||||
function simpletest_run_phpunit_tests($test_id, array $unescaped_test_classnames) {
|
||||
function simpletest_run_phpunit_tests($test_id, array $unescaped_test_classnames, &$status = NULL) {
|
||||
$phpunit_file = simpletest_phpunit_xml_filepath($test_id);
|
||||
$ret = simpletest_phpunit_run_command($unescaped_test_classnames, $phpunit_file);
|
||||
// A return value of 0 = passed test, 1 = failed test, > 1 indicates segfault
|
||||
simpletest_phpunit_run_command($unescaped_test_classnames, $phpunit_file, $status);
|
||||
// A $status of 0 = passed test, 1 = failed test, > 1 indicates segfault
|
||||
// timeout, or other type of failure.
|
||||
if ($ret > 1) {
|
||||
if ($status > 1) {
|
||||
// Something broke during the execution of phpunit.
|
||||
// Return an error record of all failed classes.
|
||||
$rows[] = [
|
||||
|
@ -251,11 +254,14 @@ function simpletest_phpunit_configuration_filepath() {
|
|||
* a regular expression to PHPUnit's --filter option.
|
||||
* @param string $phpunit_file
|
||||
* A filepath to use for PHPUnit's --log-junit option.
|
||||
* @param int $status
|
||||
* (optional) The exit status code of the PHPUnit process will be assigned to
|
||||
* this variable.
|
||||
*
|
||||
* @return string
|
||||
* The results as returned by exec().
|
||||
*/
|
||||
function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpunit_file) {
|
||||
function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpunit_file, &$status = NULL) {
|
||||
// Setup an environment variable containing the database connection so that
|
||||
// functional tests can connect to the database.
|
||||
putenv('SIMPLETEST_DB=' . Database::getConnectionInfoAsUrl());
|
||||
|
@ -292,7 +298,8 @@ function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpun
|
|||
|
||||
// exec in a subshell so that the environment is isolated when running tests
|
||||
// via the simpletest UI.
|
||||
exec(join($command, " "), $output, $ret);
|
||||
$ret = exec(join($command, " "), $output, $status);
|
||||
|
||||
chdir($old_cwd);
|
||||
putenv('SIMPLETEST_DB=');
|
||||
return $ret;
|
||||
|
|
|
@ -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