summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2013-11-19 01:09:16 (GMT)
committerAlex Pott2013-11-19 01:09:16 (GMT)
commit13ebcd222fb876238eace73c27a95241d81cc79c (patch)
tree25dbacf2ba2e043f5ac1d479ded7538d025d0b18
parent4f00351eeda05d031de094c020cdb9f1975578e7 (diff)
Issue #2125633 by tim.plunkett: PHPUnit tests cannot be rerun from Simpletest UI.
-rw-r--r--core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php22
-rw-r--r--core/modules/simpletest/simpletest.module4
2 files changed, 20 insertions, 6 deletions
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php
index 8a907f0..daa9660 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 @@ namespace Drupal\simpletest\Form;
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;
@@ -32,10 +33,20 @@ 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 @@ class SimpletestResultsForm extends FormBase {
*
* @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 @@ class SimpletestResultsForm extends FormBase {
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 da7c265..a75aa5a 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;
}
}