diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php index 8a907f031de60da56d816d063fe99cbc1d7358f9..daa9660e7f092c27058db68e88d0676c3f6aafa7 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php @@ -9,6 +9,7 @@ use Drupal\Core\Database\Connection; use Drupal\Core\Form\FormBase; +use Drupal\Core\Form\FormBuilderInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -31,11 +32,21 @@ class SimpletestResultsForm extends FormBase { */ protected $database; + /** + * The form builder service. + * + * @var \Drupal\Core\Form\FormBuilderInterface + */ + protected $formBuilder; + /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { - return new static($container->get('database')); + return new static( + $container->get('database'), + $container->get('form_builder') + ); } /** @@ -43,9 +54,12 @@ public static function create(ContainerInterface $container) { * * @param \Drupal\Core\Database\Connection $database * The database connection service. + * @param \Drupal\Core\Form\FormBuilderInterface $form_builder + * The form builder service. */ - public function __construct(Connection $database) { + public function __construct(Connection $database, FormBuilderInterface $form_builder) { $this->database = $database; + $this->formBuilder = $form_builder; // Initialize image mapping property. $image_pass = array( '#theme' => 'image', @@ -255,15 +269,13 @@ public function submitForm(array &$form, array &$form_state) { return; } - $form_execute = array(); $form_state_execute = array('values' => array()); foreach ($classes as $class) { $form_state_execute['values'][$class] = 1; } // Submit the simpletest test form to rerun the tests. - $simpletest_test_form = new SimpletestTestForm(); - $simpletest_test_form->submitForm($form_execute, $form_state_execute); + $this->formBuilder->submitForm('Drupal\simpletest\Form\SimpletestTestForm', $form_state_execute); $form_state['redirect_route'] = $form_state_execute['redirect_route']; } diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module index da7c265f972c43fae3018e8502fd3d9d15900079..a75aa5a1e05cacc32353064eadc85085955004d9 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -799,7 +799,7 @@ function simpletest_phpunit_xml_to_rows($test_id, $phpunit_xml_file) { /** * Find all testcases recursively from a testsuite list. * - * @param array $suite + * @param \SimpleXMLElement[] $suite * The list of testcases contained in the PHPUnit XML. * * @return array @@ -816,6 +816,8 @@ function simpletest_phpunit_find_testcases($suite) { } elseif (isset($testcase->testcase) && ((int) $testcase->attributes()->tests) > 0) { foreach ($testcase->testcase as $childtestcase) { + // Add the class attribute since the child test case will not have it. + $childtestcase->addAttribute('class', $suite->attributes()->name); $testcases[] = $childtestcase; } }