Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
\Drupal\Tests\system\Functional\Datetime\DrupalDateTimeTest::testTimezoneFormat doesn't make any HTTP requests.
Proposed resolution
Move \Drupal\Tests\system\Functional\Datetime\DrupalDateTimeTest::testTimezoneFormat
to an existing date kernel test or create a new one.
While you're there, remove the unnecessary ::setup method
Consider moving testSystemTimezone
too, which as per #2 could be tested via routing a Request via the Kernel.
Remaining tasks
See above
User interface changes
None
API changes
None
Comment | File | Size | Author |
---|---|---|---|
#2 | 2349453-2.patch | 3.63 KB | rpayanm |
Comments
Comment #1
Mile23Needs a reroll.
Comment #2
rpayanmComment #4
Mile23Since the goal is to speed up the test, and since only
testDateTimezone()
uses$this->account
or the current_user service, we should make a helper method for it, or inline it in the test method. The point being: We don't need to create user objects for all the tests so take it out ofsetUp()
.Comment #11
Mile23Everything has moved around. :-)
Drupal\Tests\system\Functional\Datetime\DrupalDateTimeTest::testTimezoneFormat()
could still be moved toDrupal\Tests\Core\Datetime\DrupalDateTimeTest
.Comment #12
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedComment #20
Mile23Drupal\Tests\system\Functional\Datetime\DrupalDateTimeTest
currently says this in setup:So that's a bug in that it's an unnecessary function, which is different from the scope here. But it certainly solves this issue. :-)
There's also a unit test for
Drupal\Core\Datetime\DrupalDateTime
which fills me with a warm glow.Comment #22
larowlanCrediting @mstrelan and @Mile23 for their time triaging this in #bugsmash
Comment #23
larowlan