-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mior Muhammad Zaki <[email protected]>
- Loading branch information
Showing
15 changed files
with
157 additions
and
84 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
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
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
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
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
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
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,43 @@ | ||
<?php | ||
|
||
namespace Orchestra\Testbench\Tests\Foundation\Console; | ||
|
||
use Orchestra\Testbench\Foundation\Console\TerminatingConsole; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class TerminatingConsoleTest extends TestCase | ||
{ | ||
/** @test */ | ||
public function it_can_handle_terminating_callbacks_on_terminal() | ||
{ | ||
$this->assertFalse(isset($_SERVER['TerminatingConsole.before'])); | ||
$this->assertFalse(isset($_SERVER['TerminatingConsole.beforeWhenTrue'])); | ||
$this->assertFalse(isset($_SERVER['TerminatingConsole.beforeWhenFalse'])); | ||
|
||
TerminatingConsole::before(function () { | ||
$_SERVER['TerminatingConsole.before'] = true; | ||
}); | ||
|
||
TerminatingConsole::beforeWhen(true, function () { | ||
$_SERVER['TerminatingConsole.beforeWhenTrue'] = true; | ||
}); | ||
|
||
TerminatingConsole::beforeWhen(false, function () { | ||
$_SERVER['TerminatingConsole.beforeWhenFalse'] = true; | ||
}); | ||
|
||
TerminatingConsole::handle(); | ||
|
||
$this->assertTrue(isset($_SERVER['TerminatingConsole.before'])); | ||
$this->assertTrue(isset($_SERVER['TerminatingConsole.beforeWhenTrue'])); | ||
$this->assertFalse(isset($_SERVER['TerminatingConsole.beforeWhenFalse'])); | ||
|
||
unset( | ||
$_SERVER['TerminatingConsole.before'], | ||
$_SERVER['TerminatingConsole.beforeWhenTrue'], | ||
$_SERVER['TerminatingConsole.beforeWhenFalse'], | ||
); | ||
|
||
TerminatingConsole::flush(); | ||
} | ||
} |
Oops, something went wrong.