Issue #2140505 by amateescu, tim.plunkett: Re-running a simpletest no longer displays the batch progress or duration.
parent
44c9add9ff
commit
dd5dcd1bd0
|
@ -9,7 +9,6 @@ namespace Drupal\simpletest\Form;
|
||||||
|
|
||||||
use Drupal\Core\Database\Connection;
|
use Drupal\Core\Database\Connection;
|
||||||
use Drupal\Core\Form\FormBase;
|
use Drupal\Core\Form\FormBase;
|
||||||
use Drupal\Core\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
|
|
||||||
|
@ -32,20 +31,12 @@ class SimpletestResultsForm extends FormBase {
|
||||||
*/
|
*/
|
||||||
protected $database;
|
protected $database;
|
||||||
|
|
||||||
/**
|
|
||||||
* The form builder service.
|
|
||||||
*
|
|
||||||
* @var \Drupal\Core\Form\FormBuilderInterface
|
|
||||||
*/
|
|
||||||
protected $formBuilder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public static function create(ContainerInterface $container) {
|
public static function create(ContainerInterface $container) {
|
||||||
return new static(
|
return new static(
|
||||||
$container->get('database'),
|
$container->get('database')
|
||||||
$container->get('form_builder')
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,12 +45,9 @@ class SimpletestResultsForm extends FormBase {
|
||||||
*
|
*
|
||||||
* @param \Drupal\Core\Database\Connection $database
|
* @param \Drupal\Core\Database\Connection $database
|
||||||
* The database connection service.
|
* The database connection service.
|
||||||
* @param \Drupal\Core\Form\FormBuilderInterface $form_builder
|
|
||||||
* The form builder service.
|
|
||||||
*/
|
*/
|
||||||
public function __construct(Connection $database, FormBuilderInterface $form_builder) {
|
public function __construct(Connection $database) {
|
||||||
$this->database = $database;
|
$this->database = $database;
|
||||||
$this->formBuilder = $form_builder;
|
|
||||||
// Initialize image mapping property.
|
// Initialize image mapping property.
|
||||||
$image_pass = array(
|
$image_pass = array(
|
||||||
'#theme' => 'image',
|
'#theme' => 'image',
|
||||||
|
@ -269,13 +257,19 @@ class SimpletestResultsForm extends FormBase {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$form_execute = array();
|
||||||
$form_state_execute = array('values' => array());
|
$form_state_execute = array('values' => array());
|
||||||
foreach ($classes as $class) {
|
foreach ($classes as $class) {
|
||||||
$form_state_execute['values'][$class] = 1;
|
$form_state_execute['values'][$class] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Submit the simpletest test form to rerun the tests.
|
// Submit the simpletest test form to rerun the tests.
|
||||||
$this->formBuilder->submitForm('Drupal\simpletest\Form\SimpletestTestForm', $form_state_execute);
|
// Under normal circumstances, a form object's submitForm() should never be
|
||||||
|
// called directly, FormBuilder::submitForm() should be called instead.
|
||||||
|
// However, it sets $form_state['programmed'], which disables the Batch API.
|
||||||
|
$simpletest_test_form = new SimpletestTestForm();
|
||||||
|
$simpletest_test_form->buildForm($form_execute, $form_state_execute);
|
||||||
|
$simpletest_test_form->submitForm($form_execute, $form_state_execute);
|
||||||
$form_state['redirect_route'] = $form_state_execute['redirect_route'];
|
$form_state['redirect_route'] = $form_state_execute['redirect_route'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue