Skip to content

Commit 63343c7

Browse files
Add tests
1 parent 2b0d030 commit 63343c7

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

tests/unit/Event/FacadeTest.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\Event;
11+
12+
use PHPUnit\Event\Tracer\Tracer;
13+
use PHPUnit\Framework\Attributes\CoversClass;
14+
use PHPUnit\Framework\Attributes\Small;
15+
use PHPUnit\Framework\TestCase;
16+
17+
#[CoversClass(Facade::class)]
18+
#[Small]
19+
final class FacadeTest extends TestCase
20+
{
21+
public function testSubscriberRegistrationDoesNotWorkWhenEventFacadeIsSealed(): void
22+
{
23+
$this->expectException(EventFacadeIsSealedException::class);
24+
25+
Facade::instance()->registerSubscriber(
26+
new class implements Subscriber
27+
{},
28+
);
29+
}
30+
31+
public function testTracerRegistrationDoesNotWorkWhenEventFacadeIsSealed(): void
32+
{
33+
$this->expectException(EventFacadeIsSealedException::class);
34+
35+
Facade::instance()->registerTracer(
36+
new class implements Tracer
37+
{
38+
public function trace(Event $event): void
39+
{
40+
}
41+
},
42+
);
43+
}
44+
}

0 commit comments

Comments
 (0)