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.
This patch moves the timer_* functions to a utility class so it can be unit tested outside of drupal, and converts the existing test to phpunit.
The original test was waiting way too long (4 seconds) and only asserting greater than, so the accuracy of the timers wasn't well tested. The new assertions test both greater and less than, and reduces the sleep time to 5ms.
Comment | File | Size | Author |
---|---|---|---|
#11 | drupal-1935970-11.patch | 9.01 KB | dawehner |
#9 | drupal-1935970-9.patch | 9 KB | dawehner |
#9 | interdiff.txt | 3.67 KB | dawehner |
#8 | inter.diff | 982 bytes | RobLoach |
#8 | 1935970.patch | 9.08 KB | RobLoach |
Comments
Comment #2
msonnabaum CreditAttribution: msonnabaum commentedunit-test-timers.patch queued for re-testing.
Comment #4
msonnabaum CreditAttribution: msonnabaum commentedHmm, looks like we don't register the autoloader early enough. This patch moves it farther up.
Comment #5
msonnabaum CreditAttribution: msonnabaum commentedLast one prevents configuring the autoloader, so moving it back down a bit.
Comment #6
dawehnerJust referencing a similar/reated issue: #1893306: Put the timers_() functions into a seperate component
Comment #7
rbayliss CreditAttribution: rbayliss commentedNot to bikeshed, but would this be a good time to replace our current timer implementation with the new Symfony Stopwatch component?
Comment #8
RobLoachUpdated some of the docblocks.
Let's make an issue for that: #1936640: Replace the Timer component with Symfony Stopwatch
Comment #9
dawehnerLet's use the class already.
It seems to be that we want to setup the database prefixes as early as possible, so let's keep this before loading the classes.
Just some small doc fixes included.
Comment #10
msonnabaum CreditAttribution: msonnabaum commentedAny talk about switching timers is very offtopic, let's keep it in the other issue.
Comment #11
dawehnerJust another rerole.
Comment #12
RobLoachComment #13
RobLoachComment #15
dawehner#11: drupal-1935970-11.patch queued for re-testing.
Comment #16
RobLoachComment #17
xjm#11: drupal-1935970-11.patch queued for re-testing.
Comment #18
alexpottCommitted 291dbd5 and pushed to 8.x. Thanks!
Comment #19
jibranFor change notice.
Comment #20
ParisLiakos CreditAttribution: ParisLiakos commentedAwesomeness!
Also should we create folllowups to get rid of procedural wrappers?
Comment #21
jibranre-tagging.
Comment #22
BerdirLooks like this introduced a random test failure: #1960032: Random failure in TimerUnitTest
Comment #23
ParisLiakos CreditAttribution: ParisLiakos commentedChange notice
http://drupal.org/node/1969828
Comment #25
jhedstrom