generated from ergebnis/php-package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09cdee3
commit 3480e15
Showing
6 changed files
with
115 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Copyright (c) 2021 Andreas Möller | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE.md file that was distributed with this source code. | ||
* | ||
* @see https://github.com/ergebnis/phpunit-slow-test-collector | ||
*/ | ||
|
||
namespace Ergebnis\PHPUnit\SlowTestCollector; | ||
|
||
use PHPUnit\Event; | ||
|
||
final class SlowTest | ||
{ | ||
private Event\Code\Test $test; | ||
|
||
private Event\Telemetry\Duration $duration; | ||
|
||
private function __construct( | ||
Event\Code\Test $test, | ||
Event\Telemetry\Duration $duration | ||
) { | ||
$this->test = $test; | ||
$this->duration = $duration; | ||
} | ||
|
||
public static function fromTestAndDuration( | ||
Event\Code\Test $test, | ||
Event\Telemetry\Duration $duration | ||
): self { | ||
return new self( | ||
$test, | ||
$duration | ||
); | ||
} | ||
|
||
public function test(): Event\Code\Test | ||
{ | ||
return $this->test; | ||
} | ||
|
||
public function duration(): Event\Telemetry\Duration | ||
{ | ||
return $this->duration; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Copyright (c) 2021 Andreas Möller | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE.md file that was distributed with this source code. | ||
* | ||
* @see https://github.com/ergebnis/phpunit-slow-test-collector | ||
*/ | ||
|
||
namespace Ergebnis\PHPUnit\SlowTestCollector\Test\Unit; | ||
|
||
use Ergebnis\PHPUnit\SlowTestCollector\SlowTest; | ||
use Ergebnis\Test\Util; | ||
use PHPUnit\Event; | ||
use PHPUnit\Framework; | ||
|
||
/** | ||
* @internal | ||
* | ||
* @covers \Ergebnis\PHPUnit\SlowTestCollector\SlowTest | ||
*/ | ||
final class SlowTestTest extends Framework\TestCase | ||
{ | ||
use Util\Helper; | ||
|
||
public function testFromTestAndDurationReturnsSlowTest(): void | ||
{ | ||
$faker = self::faker(); | ||
|
||
$test = new Event\Code\Test( | ||
self::class, | ||
$faker->word, | ||
$faker->word | ||
); | ||
|
||
$duration = Event\Telemetry\Duration::fromSeconds($faker->numberBetween()); | ||
|
||
$slowTest = SlowTest::fromTestAndDuration( | ||
$test, | ||
$duration | ||
); | ||
|
||
self::assertSame($test, $slowTest->test()); | ||
self::assertSame($duration, $slowTest->duration()); | ||
} | ||
} |