Skip to content
Permalink
Browse files

Explicity return floats for DefaultTestResultCache::getTime

This method has a float return type, and the fallback return value
should also be an explicit float, not an int.
  • Loading branch information...
oliverklee authored and sebastianbergmann committed May 3, 2019
1 parent 544c24c commit 92fd54b2e1112e033e42c0dceb0d788b7aa5bde0
Showing with 35 additions and 1 deletion.
  1. +1 −1 src/Runner/DefaultTestResultCache.php
  2. +34 −0 tests/unit/Runner/DefaultTestResultCacheTest.php
@@ -127,7 +127,7 @@ public function setTime(string $testName, float $time): void
public function getTime(string $testName): float
{
return $this->times[$testName] ?? 0;
return $this->times[$testName] ?? 0.0;
}
public function load(): void
@@ -0,0 +1,34 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Runner;
use PHPUnit\Framework\TestCase;
/**
* @covers \PHPUnit\Runner\DefaultTestResultCache
* @small
*/
final class DefaultTestResultCacheTest extends TestCase
{
/**
* @var DefaultTestResultCache
*/
private $subject;
protected function setUp(): void
{
$this->subject = new DefaultTestResultCache();
}
public function testGetTimeForInexistentTestNameReturnsZero(): void
{
$this->assertSame(0.0, $this->subject->getTime('doesNotExist'));
}
}

0 comments on commit 92fd54b

Please sign in to comment.
You can’t perform that action at this time.