updated core to 8.6.1 via composer
This commit is contained in:
@@ -389,12 +389,12 @@ function simpletest_phpunit_command() {
|
||||
|
||||
// The file in Composer's bin dir is a *nix link, which does not work when
|
||||
// extracted from a tarball and generally not on Windows.
|
||||
$command = $vendor_dir . '/phpunit/phpunit/phpunit';
|
||||
$command = escapeshellarg($vendor_dir . '/phpunit/phpunit/phpunit');
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
// On Windows it is necessary to run the script using the PHP executable.
|
||||
$php_executable_finder = new PhpExecutableFinder();
|
||||
$php = $php_executable_finder->find();
|
||||
$command = $php . ' -f ' . escapeshellarg($command) . ' --';
|
||||
$command = $php . ' -f ' . $command . ' --';
|
||||
}
|
||||
return $command;
|
||||
}
|
||||
@@ -403,7 +403,7 @@ function simpletest_phpunit_command() {
|
||||
* Implements callback_batch_operation().
|
||||
*/
|
||||
function _simpletest_batch_operation($test_list_init, $test_id, &$context) {
|
||||
simpletest_classloader_register();
|
||||
\Drupal::service('test_discovery')->registerTestNamespaces();
|
||||
// Get working values.
|
||||
if (!isset($context['sandbox']['max'])) {
|
||||
// First iteration: initialize working values.
|
||||
@@ -475,7 +475,7 @@ function _simpletest_batch_operation($test_list_init, $test_id, &$context) {
|
||||
*/
|
||||
function _simpletest_batch_finished($success, $results, $operations, $elapsed) {
|
||||
if ($success) {
|
||||
drupal_set_message(t('The test run finished in @elapsed.', ['@elapsed' => $elapsed]));
|
||||
\Drupal::messenger()->addStatus(t('The test run finished in @elapsed.', ['@elapsed' => $elapsed]));
|
||||
}
|
||||
else {
|
||||
// Use the test_id passed as a parameter to _simpletest_batch_operation().
|
||||
@@ -487,8 +487,8 @@ function _simpletest_batch_finished($success, $results, $operations, $elapsed) {
|
||||
list($last_prefix, $last_test_class) = simpletest_last_test_get($test_id);
|
||||
simpletest_log_read($test_id, $last_prefix, $last_test_class);
|
||||
|
||||
drupal_set_message(t('The test run did not successfully finish.'), 'error');
|
||||
drupal_set_message(t('Use the <em>Clean environment</em> button to clean-up temporary files and tables.'), 'warning');
|
||||
\Drupal::messenger()->addError(t('The test run did not successfully finish.'));
|
||||
\Drupal::messenger()->addWarning(t('Use the <em>Clean environment</em> button to clean-up temporary files and tables.'));
|
||||
}
|
||||
\Drupal::moduleHandler()->invokeAll('test_group_finished');
|
||||
}
|
||||
@@ -587,6 +587,7 @@ function simpletest_log_read($test_id, $database_prefix, $test_class) {
|
||||
* instead.
|
||||
*/
|
||||
function simpletest_test_get_all($extension = NULL, array $types = []) {
|
||||
@trigger_error('The ' . __FUNCTION__ . ' function is deprecated in version 8.3.x and will be removed in 9.0.0. Use \Drupal::service(\'test_discovery\')->getTestClasses($extension, $types) instead.', E_USER_DEPRECATED);
|
||||
return \Drupal::service('test_discovery')->getTestClasses($extension, $types);
|
||||
}
|
||||
|
||||
@@ -597,6 +598,7 @@ function simpletest_test_get_all($extension = NULL, array $types = []) {
|
||||
* \Drupal::service('test_discovery')->registerTestNamespaces() instead.
|
||||
*/
|
||||
function simpletest_classloader_register() {
|
||||
@trigger_error('The ' . __FUNCTION__ . ' function is deprecated in version 8.3.x and will be removed in 9.0.0. Use \Drupal::service(\'test_discovery\')->registerTestNamespaces() instead.', E_USER_DEPRECATED);
|
||||
\Drupal::service('test_discovery')->registerTestNamespaces();
|
||||
}
|
||||
|
||||
@@ -656,37 +658,34 @@ function simpletest_clean_environment() {
|
||||
simpletest_clean_temporary_directories();
|
||||
if (\Drupal::config('simpletest.settings')->get('clear_results')) {
|
||||
$count = simpletest_clean_results_table();
|
||||
drupal_set_message(\Drupal::translation()->formatPlural($count, 'Removed 1 test result.', 'Removed @count test results.'));
|
||||
\Drupal::messenger()->addStatus(\Drupal::translation()->formatPlural($count, 'Removed 1 test result.', 'Removed @count test results.'));
|
||||
}
|
||||
else {
|
||||
drupal_set_message(t('Clear results is disabled and the test results table will not be cleared.'), 'warning');
|
||||
\Drupal::messenger()->addWarning(t('Clear results is disabled and the test results table will not be cleared.'), 'warning');
|
||||
}
|
||||
|
||||
// Detect test classes that have been added, renamed or deleted.
|
||||
\Drupal::cache()->delete('simpletest');
|
||||
\Drupal::cache()->delete('simpletest_phpunit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes prefixed tables from the database from crashed tests.
|
||||
*/
|
||||
function simpletest_clean_database() {
|
||||
$schema = Database::getConnection()->schema();
|
||||
$tables = db_find_tables('test%');
|
||||
$count = 0;
|
||||
foreach ($tables as $table) {
|
||||
// Only drop tables which begin wih 'test' followed by digits, for example,
|
||||
// {test12345678node__body}.
|
||||
if (preg_match('/^test\d+.*/', $table, $matches)) {
|
||||
db_drop_table($matches[0]);
|
||||
$schema->dropTable($matches[0]);
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($count > 0) {
|
||||
drupal_set_message(\Drupal::translation()->formatPlural($count, 'Removed 1 leftover table.', 'Removed @count leftover tables.'));
|
||||
\Drupal::messenger()->addStatus(\Drupal::translation()->formatPlural($count, 'Removed 1 leftover table.', 'Removed @count leftover tables.'));
|
||||
}
|
||||
else {
|
||||
drupal_set_message(t('No leftover tables to remove.'));
|
||||
\Drupal::messenger()->addStatus(t('No leftover tables to remove.'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -709,10 +708,10 @@ function simpletest_clean_temporary_directories() {
|
||||
}
|
||||
|
||||
if ($count > 0) {
|
||||
drupal_set_message(\Drupal::translation()->formatPlural($count, 'Removed 1 temporary directory.', 'Removed @count temporary directories.'));
|
||||
\Drupal::messenger()->addStatus(\Drupal::translation()->formatPlural($count, 'Removed 1 temporary directory.', 'Removed @count temporary directories.'));
|
||||
}
|
||||
else {
|
||||
drupal_set_message(t('No temporary directories to remove.'));
|
||||
\Drupal::messenger()->addStatus(t('No temporary directories to remove.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user