Skip to content
This repository was archived by the owner on May 19, 2020. It is now read-only.

Commit 3e6806e

Browse files
committed
ProcessFake
1 parent 928fe2b commit 3e6806e

File tree

8 files changed

+25
-16
lines changed

8 files changed

+25
-16
lines changed

app/Http/Controllers/Modules/FirewallController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace App\Http\Controllers\Modules;
44

5-
use App\Process;
5+
use Facades\App\Process;
66
use Facades\App\Disk;
77
use App\Http\Controllers\Controller;
88
use App\Models\Expressive\Firewall;

app/Process.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88

99
class Process
1010
{
11-
public static function deploy()
11+
public function deploy()
1212
{
1313
// @TODO: test if I can just use ./vendor/bin/envoy
1414
$command = base_path('/vendor/bin/envoy') . ' run deploy';
1515

16-
return (new Process)->run($command);
16+
return $this->run($command);
1717
}
1818

19-
public static function firewall()
19+
public function firewall()
2020
{
21-
return (new Process)->run('/etc/rc.d/rc.firewall', '/');
21+
return $this->run('/etc/rc.d/rc.firewall', '/');
2222
}
2323

24-
public function run($command, $directory = null)
24+
protected function run($command, $directory = null)
2525
{
2626
$directory = $directory ?: base_path();
2727

config/app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
'name' => env('APP_NAME', 'Thunderwall'),
1717

18-
'version' => '0.0.8',
18+
'version' => '0.0.9',
1919

2020
/*
2121
|--------------------------------------------------------------------------
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use App\Disk;
66

7-
class FakeDisk extends Disk
7+
class DiskFake extends Disk
88
{
99

1010
/**

tests/Fake/ProcessFake.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class ProcessFake extends Process
1212
*/
1313
protected $commands = [];
1414

15-
public function run($command, $directory = null)
15+
protected function run($command, $directory = null)
1616
{
1717
$this->commands[] = $command;
1818
}

tests/Feature/AuthenticatedTestCase.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Facades\App\Disk;
77
use Illuminate\Foundation\Testing\RefreshDatabase;
88
use Illuminate\Support\Facades\Cache;
9-
use Tests\Fake\FakeDisk;
9+
use Tests\Fake\DiskFake;
1010

1111
abstract class AuthenticatedTestCase extends DatabaseTestCase
1212
{
@@ -22,11 +22,5 @@ protected function setUp()
2222
parent::setUp();
2323

2424
$this->actingAs($this->user = create(User::class));
25-
26-
// Redirect any file creation to /storage/tests
27-
Disk::swap(new FakeDisk);
28-
29-
// Avoid GitHub API by Default
30-
Cache::put('updateAvailable', false, 1);
3125
}
3226
}

tests/Feature/Firewall/FirewallTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Tests\Feature;
44

55
use App\Models\Expressive\Firewall;
6+
use Facades\App\Process;
67
use Tests\AuthenticatedTestCase;
78

89
class FirewallTest extends AuthenticatedTestCase
@@ -30,5 +31,6 @@ public function a_user_can_change_the_firewall_settings()
3031
->assertSessionHas('success');
3132

3233
$this->assertDatabaseHas('sections', ['file_id' => $file->id, 'content' => $content]);
34+
Process::assertExecuted('/etc/rc.d/rc.firewall');
3335
}
3436
}

tests/TestCase.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@
33
namespace Tests;
44

55
use App\Models\User;
6+
use Facades\App\Process;
7+
use Facades\App\Disk;
68
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
79
use Illuminate\Foundation\Testing\TestResponse;
810
use Illuminate\Http\Response;
11+
use Illuminate\Support\Facades\Cache;
12+
use Tests\Fake\DiskFake;
13+
use Tests\Fake\ProcessFake;
914

1015
abstract class TestCase extends BaseTestCase
1116
{
@@ -32,6 +37,14 @@ protected function setUp()
3237

3338
return $this;
3439
});
40+
41+
// Redirect any file creation to /storage/tests
42+
Disk::swap(new DiskFake);
43+
44+
Process::swap(new ProcessFake);
45+
46+
// Avoid GitHub API by Default
47+
Cache::put('updateAvailable', false, 1);
3548
}
3649

3750
public function signIn(User $user = null)

0 commit comments

Comments
 (0)