-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Override Illuminate up/down commands by default, refactor tests
- Loading branch information
Showing
7 changed files
with
116 additions
and
51 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,42 @@ | ||
<?php | ||
|
||
namespace Konsulting\Laravel\MaintenanceMode\Tests\Integration; | ||
|
||
use Konsulting\Laravel\MaintenanceMode\Commands\SiteDownCommand; | ||
use Konsulting\Laravel\MaintenanceMode\Commands\SiteUpCommand; | ||
|
||
class CommandsTest extends IntegrationTestCase | ||
{ | ||
/** @test */ | ||
public function it_activates_maintenance_mode() | ||
{ | ||
$this->artisan('site:down', [ | ||
'--message' => 'Test', | ||
'--retry' => 123, | ||
'--allow' => ['1.1.1.1', '2.2.2.2'], | ||
]); | ||
|
||
$this->assertTrue($this->maintenanceMode->isOn()); | ||
$data = $this->maintenanceMode->getDownInformation(); | ||
$this->assertSame('Test', $data->getMessage()); | ||
$this->assertSame(123, $data->getRetryTime()); | ||
$this->assertSame(['1.1.1.1', '2.2.2.2'], $data->getAllowedAddresses()); | ||
} | ||
|
||
/** @test */ | ||
public function it_deactivates_maintenance_mode() | ||
{ | ||
$this->maintenanceMode->on(); | ||
$this->assertTrue($this->maintenanceMode->isOn()); | ||
|
||
$this->artisan('site:up'); | ||
$this->assertFalse($this->maintenanceMode->isOn()); | ||
} | ||
|
||
/** @test */ | ||
public function it_overrides_the_default_illuminate_commands_by_default() | ||
{ | ||
$this->assertInstanceOf(SiteUpCommand::class, $this->app->make('command.up')); | ||
$this->assertInstanceOf(SiteDownCommand::class, $this->app->make('command.down')); | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
namespace Konsulting\Laravel\MaintenanceMode\Tests\Integration; | ||
|
||
use Illuminate\Foundation\Console\DownCommand; | ||
use Illuminate\Foundation\Console\UpCommand; | ||
|
||
class ConfigTest extends IntegrationTestCase | ||
{ | ||
protected function getEnvironmentSetUp($app) | ||
{ | ||
parent::getEnvironmentSetUp($app); | ||
|
||
$app['config']->set('maintenance_mode.override_illuminate_commands', false); | ||
} | ||
|
||
/** @test */ | ||
public function it_does_not_override_the_default_illuminate_commands() | ||
{ | ||
$this->assertInstanceOf(UpCommand::class, $this->app->make('command.up')); | ||
$this->assertInstanceOf(DownCommand::class, $this->app->make('command.down')); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
tests/Commands/CommandTestCase.php → tests/Integration/IntegrationTestCase.php
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