Skip to content

Commit 9f20e61

Browse files
committed
Init container before DataProvider is called
1 parent dd41088 commit 9f20e61

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/bootstrap.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?php declare(strict_types = 1);
22

3+
use PHPStan\Testing\PHPStanTestCase;
4+
use PHPUnit\Event\Facade;
5+
use PHPUnit\Event\Test\DataProviderMethodCalled;
6+
use PHPUnit\Event\Test\DataProviderMethodCalledSubscriber;
7+
38
error_reporting(E_ALL);
49

510
require_once __DIR__ . '/../vendor/autoload.php';
@@ -19,3 +24,16 @@ public function doFoo($i)
1924
}
2025
2126
}');
27+
28+
class InitContainerBeforeDataProvider implements DataProviderMethodCalledSubscriber
29+
{
30+
31+
public function notify(DataProviderMethodCalled $event): void
32+
{
33+
PHPStanTestCase::getContainer();
34+
}
35+
36+
}
37+
38+
39+
Facade::instance()->registerSubscriber(new InitContainerBeforeDataProvider());

0 commit comments

Comments
 (0)