Closed (fixed)
Project:
Drupal core
Version:
8.8.x-dev
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
18 Aug 2019 at 13:45 UTC
Updated:
12 Sep 2019 at 03:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mondrakeComment #3
mile23Maybe a duplicate of #3075608: Introduce TestRun objects and refactor TestDatabase to be testable
Comment #4
mondrake#3074043: Move simpletest.module DB-related functions to TestDatabase, deprecate is in, unpostponing.
Comment #5
mondrake#3 I do not think this is a duplicate of #3075608: Introduce TestRun objects and refactor TestDatabase to be testable, the scope of this is to just use dynamic query API in place of static queries within
TestDatabase::lastTestGet.Here's the idea: the Select API in the patch will produce the following SQL statement:
which is doing the same job of the current two separate queries.
I am also changing
TestDatabase::lastTestGetto return directly the associative array fetched from the DB.Comment #6
mondrakeI came across a pre-existing bug while testing this patch running simpletest test via
run-tests.sh, when there are failing tests (yes, a bit of an edge case in core nowadays, but still...).A
$last_test_classis undefined in run-tests.sh, leading to notices being thrown in the CLI:PHP Notice: Undefined variable: last_test_class in /home/travis/drupal8/core/scripts/run-tests.sh on line 936Fixing here.
Comment #7
mile23Nice catch on #6. The docblock for
simpletest_script_cleanup()is wrong. It's weird that you can only clean up after PHPUnit by passing in--clean. That's a side-effect that's used by the testbot, though, so let's not work too hard to change it...The rest LGTM.
Comment #8
larowlanI said the same thing over in [#13225478] - are we sure we don't want to use a value object here?
Happy for the answer to be no, this code is legacy
Comment #9
mile23I think @mondrake might be reaching a similar conclusion in #3075608-3: Introduce TestRun objects and refactor TestDatabase to be testable
I'd wager there's at least a slight performance benefit to one query instead of two... This code runs at least once per test class per drupalci build, so ~27,000 times.
Comment #10
mondrakecan I suggest we defer that discussion to #3075608: Introduce TestRun objects and refactor TestDatabase to be testable, where we are experimenting with an object that tracks the test run? There is a very initial patch for review there.
Comment #11
larowlanCommitted 5c326c9 and pushed to 8.8.x. Thanks!