Since #1901670: Start using PHPUnit for unit tests the output of simpletest_script_get_test_list is expected to be something like:
array(
'group' => array(
'testclass1',
'testclass2',
),
);
However if you use --module or --class then this function currently returns
array(
'testclass1',
'testclass2',
);
as it used too. This means that simpletest_script_execute_batch flattens the test_group array to an empty array and no tests are run.
So for example, without this patch the following command is a total fail...
$ php ./core/scripts/run-tests.sh --class "Drupal\book\Tests\BookTest"
Comments
Comment #1
alexpottThe patch attached is a comprise... basically instead of trying to determine the correct test group for --class and --module we just use 'class' and 'module' as the test group... this keeps us clear of the following code in
simpletest_script_execute_batch()whilst making this code work...
The group key is only used by the PHPUnit additions to run_tests.sh so this change minimises the impact and just works.
Comment #2
alexpottThe patch attached reverts the change to pass test lists around keyed by group eg...
And instead detects is the class is a PHPUnit test using
is_subclass_of(). This means you can mix classes like this...Where one test is PHPUnit and one test is a WebTestBase :)
Comment #3
alexpottNow for the patch
Comment #4
alexpottThis patch also fixes this small bug with PHPUnit test summarisation.
Comment #5
msonnabaum commentedTotally fine with this. If testbot comes back ok, I think this is RTBC.
Comment #6
msonnabaum commentedComment #7
catch#3: 1936806.run-tests.2.patch queued for re-testing.
Comment #8
dries commentedCommitted to 8.x. Thanks.
Comment #9.0
(not verified) commentedAdd example command