File tree Expand file tree Collapse file tree 3 files changed +17
-8
lines changed
Expand file tree Collapse file tree 3 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 33namespace Zalas \PHPUnit \Globals ;
44
55use PHPUnit \Event \Code \TestMethod ;
6- use PHPUnit \Event \Test \Prepared ;
7- use PHPUnit \Event \Test \PreparedSubscriber ;
6+ use PHPUnit \Event \Test \PreparationStarted ;
7+ use PHPUnit \Event \Test \PreparationStartedSubscriber ;
88use PHPUnit \Metadata \Annotation \Parser \Registry ;
99
10- final class GlobalsAnnotationReader implements PreparedSubscriber
10+ final class GlobalsAnnotationReader implements PreparationStartedSubscriber
1111{
12- public function notify (Prepared $ event ): void
12+ public function notify (PreparationStarted $ event ): void
1313 {
1414 $ this ->readGlobalAnnotations ($ event ->test ());
1515 }
Original file line number Diff line number Diff line change 22
33namespace Zalas \PHPUnit \Globals ;
44
5- use PHPUnit \Event \Test \Prepared ;
6- use PHPUnit \Event \Test \PreparedSubscriber ;
5+ use PHPUnit \Event \Test \PreparationStarted ;
6+ use PHPUnit \Event \Test \PreparationStartedSubscriber ;
77
8- final class GlobalsBackup implements PreparedSubscriber
8+ final class GlobalsBackup implements PreparationStartedSubscriber
99{
1010 private $ server ;
1111 private $ env ;
1212 private $ getenv ;
1313
14- public function notify (Prepared $ event ): void
14+ public function notify (PreparationStarted $ event ): void
1515 {
1616 $ this ->server = $ _SERVER ;
1717 $ this ->env = $ _ENV ;
Original file line number Diff line number Diff line change 66use PHPUnit \Framework \TestCase ;
77
88/**
9+ * @env AVAILABLE_IN_SETUP=foo
910 * @env APP_ENV=test
1011 * @server APP_DEBUG=0
1112 * @putenv APP_HOST=localhost
1213 */
1314class AnnotationExtensionTest extends TestCase
1415{
16+ protected function setUp (): void
17+ {
18+ parent ::setUp ();
19+
20+ $ this ->assertArrayHasKey ('AVAILABLE_IN_SETUP ' , $ _ENV );
21+ $ this ->assertSame ('foo ' , $ _ENV ['AVAILABLE_IN_SETUP ' ]);
22+ }
23+
1524 /**
1625 * @env APP_ENV=test_foo
1726 * @server APP_DEBUG=1
You can’t perform that action at this time.
0 commit comments