-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
3 changed files
with
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Tests\Tempest\Integration; | ||
|
||
use App\Events\ItHappened; | ||
use App\Events\MyEventHandler; | ||
use Tests\Tempest\IntegrationTest; | ||
use function Tempest\event; | ||
|
||
class EventIntegrationTest extends IntegrationTest | ||
{ | ||
public function test_event(): void | ||
{ | ||
MyEventHandler::$itHappened = false; | ||
|
||
event(new ItHappened()); | ||
|
||
$this->assertTrue(MyEventHandler::$itHappened); | ||
} | ||
} |
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,35 @@ | ||
<?php | ||
|
||
namespace Tests\Tempest; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Tempest\AppConfig; | ||
use Tempest\Container\Container; | ||
use Tempest\Discovery\DiscoveryLocation; | ||
use Tempest\Kernel; | ||
|
||
abstract class IntegrationTest extends TestCase | ||
{ | ||
protected AppConfig $appConfig; | ||
protected Kernel $kernel; | ||
protected Container $container; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->appConfig = new AppConfig( | ||
root: __DIR__ . '/..', | ||
discoveryCache: true, | ||
discoveryLocations: [ | ||
new DiscoveryLocation( | ||
'App\\', | ||
__DIR__ . '/../app/', | ||
), | ||
], | ||
); | ||
|
||
$this->kernel = new Kernel($this->appConfig); | ||
$this->container = $this->kernel->init(); | ||
} | ||
} |