-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
1 parent
810a834
commit c71cdf7
Showing
5 changed files
with
95 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,8 @@ | ||
<?php | ||
|
||
namespace Illuminate\Foundation\Events; | ||
|
||
class Terminating | ||
{ | ||
// | ||
} |
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,35 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Foundation\Console; | ||
|
||
use Illuminate\Events\Dispatcher; | ||
use Illuminate\Foundation\Application; | ||
use Illuminate\Foundation\Console\Kernel; | ||
use Illuminate\Foundation\Events\Terminating; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\Console\Input\StringInput; | ||
|
||
class KernelTest extends TestCase | ||
{ | ||
public function testItDispatchesTerminatingEvent() | ||
{ | ||
$called = []; | ||
$app = new Application; | ||
$events = new Dispatcher($app); | ||
$app->instance('events', $events); | ||
$kernel = new Kernel($app, $events); | ||
$events->listen(function (Terminating $terminating) use (&$called) { | ||
$called[] = 'terminating event'; | ||
}); | ||
$app->terminating(function () use (&$called) { | ||
$called[] = 'terminating callback'; | ||
}); | ||
|
||
$kernel->terminate(new StringInput('tinker'), 0); | ||
|
||
$this->assertSame([ | ||
'terminating event', | ||
'terminating callback', | ||
], $called); | ||
} | ||
} |
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