-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable/Disable DNS. Add Tests. (#73)
* Enable/Disable DNS. * Add/Improve Tests (inc. YamlBuilder). * Cheeky refactor of the Ngrok\Open command
- Loading branch information
Showing
14 changed files
with
498 additions
and
38 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,32 @@ | ||
<?php | ||
|
||
namespace App\Commands\Dns; | ||
|
||
use App\Commands\BaseCommand; | ||
|
||
class Off extends BaseCommand | ||
{ | ||
/** | ||
* The signature of the command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'dns:off'; | ||
|
||
/** | ||
* The description of the command. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Turn DNS container off'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return void | ||
*/ | ||
public function handle(): void | ||
{ | ||
$this->porter->turnOffService('dns'); | ||
} | ||
} |
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,32 @@ | ||
<?php | ||
|
||
namespace App\Commands\Dns; | ||
|
||
use App\Commands\BaseCommand; | ||
|
||
class On extends BaseCommand | ||
{ | ||
/** | ||
* The signature of the command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'dns:on'; | ||
|
||
/** | ||
* The description of the command. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Turn DNS container on'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return void | ||
*/ | ||
public function handle(): void | ||
{ | ||
$this->porter->turnOnService('dns'); | ||
} | ||
} |
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,25 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\Commands\Dns; | ||
|
||
use App\PorterLibrary; | ||
use App\Support\Mechanics\Mechanic; | ||
use Mockery; | ||
use Tests\BaseTestCase; | ||
|
||
class FlushTest extends BaseTestCase | ||
{ | ||
/** @test */ | ||
public function it_will_flush_the_dns() | ||
{ | ||
$mechanicMock = Mockery::mock(Mechanic::class); | ||
$mechanicMock | ||
->shouldIgnoreMissing() | ||
->shouldReceive('flushDns')->withNoArgs()->once(); | ||
|
||
$this->app->instance(Mechanic::class, $mechanicMock); | ||
$this->app->get(PorterLibrary::class)->setMechanic($mechanicMock); | ||
|
||
$this->artisan('dns:flush'); | ||
} | ||
} |
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,19 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\Commands\Dns; | ||
|
||
use Tests\BaseTestCase; | ||
use Tests\Unit\Support\Concerns\MocksPorter; | ||
|
||
class OffTest extends BaseTestCase | ||
{ | ||
use MocksPorter; | ||
|
||
/** @test */ | ||
public function it_turns_the_dns_off() | ||
{ | ||
$this->porter->shouldReceive('turnOffService')->with('dns')->once(); | ||
|
||
$this->artisan('dns:off'); | ||
} | ||
} |
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,19 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\Commands\Dns; | ||
|
||
use Tests\BaseTestCase; | ||
use Tests\Unit\Support\Concerns\MocksPorter; | ||
|
||
class OnTest extends BaseTestCase | ||
{ | ||
use MocksPorter; | ||
|
||
/** @test */ | ||
public function it_turns_the_dns_on() | ||
{ | ||
$this->porter->shouldReceive('turnOnService')->with('dns')->once(); | ||
|
||
$this->artisan('dns:on'); | ||
} | ||
} |
Oops, something went wrong.