forked from sebastianbergmann/phpunit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancement: Emit TestCase\BeforeClass event
Related to #44. Co-authored-by: Andreas Möller <am@localheinz.com> Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
- Loading branch information
1 parent
950776d
commit dd1d176
Showing
9 changed files
with
114 additions
and
0 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?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\Event\TestCase; | ||
|
||
use PHPUnit\Event\Event; | ||
use PHPUnit\Event\Telemetry; | ||
|
||
final class BeforeClassCalled implements Event | ||
{ | ||
private Telemetry\Info $telemetryInfo; | ||
|
||
public function __construct(Telemetry\Info $telemetryInfo) | ||
{ | ||
$this->telemetryInfo = $telemetryInfo; | ||
} | ||
|
||
public function telemetryInfo(): Telemetry\Info | ||
{ | ||
return $this->telemetryInfo; | ||
} | ||
} |
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,17 @@ | ||
<?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\Event\TestCase; | ||
|
||
use PHPUnit\Event\Subscriber; | ||
|
||
interface BeforeClassCalledSubscriber extends Subscriber | ||
{ | ||
public function notify(BeforeClassCalled $event): void; | ||
} |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?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\Event\TestCase; | ||
|
||
use PHPUnit\Event\AbstractEventTestCase; | ||
|
||
/** | ||
* @covers \PHPUnit\Event\TestCase\BeforeClassCalled | ||
*/ | ||
final class BeforeClassCalledTest extends AbstractEventTestCase | ||
{ | ||
public function testConstructorSetsValues(): void | ||
{ | ||
$telemetryInfo = self::createTelemetryInfo(); | ||
|
||
$event = new BeforeClassCalled($telemetryInfo); | ||
|
||
$this->assertSame($telemetryInfo, $event->telemetryInfo()); | ||
} | ||
} |