Updated: Comment #0

Problem/Motivation

After running a test from the Simpletest UI, you can rerun it from the results form, unless it is a PHPUnit test.
In addition, when rerunning any tests, notices will appear (but only in the dblog, because the UI eats them):

Notice: Undefined index: storage in Drupal\simpletest\Form\SimpletestTestForm->submitForm() (line 104 of /var/www/d8/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestTestForm.php).

Warning: array_keys() expects parameter 1 to be array, null given in Drupal\simpletest\Form\SimpletestTestForm->submitForm() (line 104 of /var/www/d8/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestTestForm.php).

Warning: in_array() expects parameter 2 to be array, null given in Drupal\simpletest\Form\SimpletestTestForm->submitForm() (line 110 of /var/www/d8/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestTestForm.php).

This is because FormInterface::submitForm() is being called directly, and not via FormBuilder::submitForm().
Note that this was a problem before the FormInterface/FormBuilder code, and was a bug in the initial PHPUnit/Simpletest integration.

Once fixing this, any PHPUnit tests using @dataProvider would fail to correctly display the results for the entire testsuite.

Proposed resolution

Use the correct approach to submitting the form, and allow @dataProvider-based tests to be correctly reported.

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim.plunkett’s picture

Status: Active » Needs review
FileSize
3.26 KB
dawehner’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +PHPUnit

This cannot be found without the important tag.

This fixes something so fine.

Xano’s picture

1: simpletest-2125633-1.patch queued for re-testing.

Xano’s picture

1: simpletest-2125633-1.patch queued for re-testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 1: simpletest-2125633-1.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
3.28 KB

s/redirect/redirect_route/

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 13ebcd2 and pushed to 8.x. Thanks!

amateescu’s picture

Status: Fixed » Needs review
FileSize
2.16 KB

This patch made the UI for re-running "regular" tests from the simpletest UI misbehave, you're not redirected to the batch page and you don't get the actual number of seconds needed to run the test anymore.

Here's a simpler way to achieve the initial goal.

xjm’s picture

To clarify, the UI test runner is not entirely broken:

timplunkett: xjm: it just hides the number of seconds it took to run. in the UI only
amateescu: xjm: I mean, re-testing works, it just doesn't take you to the batch page and you get a 0 seconds time

tim.plunkett’s picture

FileSize
2.62 KB

Bummer. But let's take this opportunity to educate.

Status: Needs review » Needs work

The last submitted patch, 8: 2125633-followup.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Fixed
Related issues: +#2140505: Re-running a simpletest no longer displays the batch progress or duration

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.