Current test coverage is 38% for \Drupal\Component\Utility\Timer.

See #1938068: Convert UnitTestBase to PHPUnit.

Comments

jhedstrom’s picture

Status: Active » Needs review
StatusFileSize
new2.4 KB

This increases coverage to 100%. Some acrobatics involved to hit all the code (start, stop, start, etc).

dawehner’s picture

Status: Needs review » Needs work
--- a/core/tests/Drupal/Tests/Component/Utility/TimerUnitTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/TimerUnitTest.phpundefined

+++ b/core/tests/Drupal/Tests/Component/Utility/TimerUnitTest.phpundefined
@@ -46,13 +46,32 @@ public function testTimer() {

I guess we want to rename the class as well?

jhedstrom’s picture

Status: Needs work » Needs review
StatusFileSize
new2.95 KB

Good catch!

Status: Needs review » Needs work
Issue tags: -PHPUnit

The last submitted patch, timer-phpunit-2049817-03.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
Issue tags: +PHPUnit

#3: timer-phpunit-2049817-03.patch queued for re-testing.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Great!

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Awesome work!

I was a bit confused on why we rename the class here, but Daniel pointed out it was a PHPUnit naming convention that allows you to easily swap back and forth between the class and its tests in IDEs like PHPStorm. Fair enough!

Committed and pushed to 8.x. Thanks!

dawehner’s picture

Thank you very much!!

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