Skip to content

Commit ceed917

Browse files
authored
Merge pull request #87 from crynobone/workbench
Uses latest Testbench features.
2 parents 6745f88 + d461468 commit ceed917

File tree

5 files changed

+22
-32
lines changed

5 files changed

+22
-32
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ coverage
66
docs
77
phpunit.xml
88
phpstan.neon
9-
testbench.yaml
109
vendor
1110
node_modules
12-
resources/js/*.log
11+
resources/js/*.log

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"laravel/pint": "^1.0",
2828
"nunomaduro/collision": "^7.9",
2929
"nunomaduro/larastan": "^2.0.1",
30-
"orchestra/testbench": "^8.0",
30+
"orchestra/testbench": "^8.18",
3131
"pestphp/pest": "^2.0",
3232
"pestphp/pest-plugin-arch": "^2.0",
3333
"pestphp/pest-plugin-laravel": "^2.0",

testbench.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
providers:
2+
- Native\Electron\ElectronServiceProvider
3+
4+
migrations: false
5+
6+
workbench:
7+
install: false

tests/ExampleTest.php

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
<?php
22

33
use Illuminate\Support\Facades\Process;
4-
use Symfony\Component\Process\PhpExecutableFinder;
54

6-
it('can boot up the app', function () {
7-
$executableFinder = new PhpExecutableFinder();
8-
$php = $executableFinder->find(false);
9-
10-
copy(
11-
from: __DIR__.'/fixtures/artisan',
12-
to: base_path('artisan'),
13-
);
5+
use function Orchestra\Testbench\remote;
146

15-
$process = Process::path(base_path())
16-
->tty()
17-
->start($php.' artisan native:serve', function ($type, $line) {
18-
echo $line;
19-
});
7+
it('can boot up the app', function () {
8+
$process = remote('native:serve');
9+
$process->setTty(true)->start(function ($type, $line) {
10+
echo $line;
11+
});
2012

2113
try {
2214
retry(12, function () {
@@ -28,11 +20,11 @@
2820
}
2921
}, 5000);
3022
} catch (Exception $e) {
31-
Process::run('pkill -9 -P '.$process->id());
23+
Process::run('pkill -9 -P '.$process->getPid());
3224
throw $e;
3325
}
3426

35-
Process::run('pkill -9 -P '.$process->id());
27+
Process::run('pkill -9 -P '.$process->getPid());
3628

3729
expect(true)->toBeTrue();
3830
});

tests/TestCase.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,19 @@
33
namespace Native\Electron\Tests;
44

55
use Illuminate\Support\Facades\Artisan;
6-
use Native\Electron\ElectronServiceProvider;
6+
use Orchestra\Testbench\Attributes\WithConfig;
7+
use Orchestra\Testbench\Concerns\WithWorkbench;
78
use Orchestra\Testbench\TestCase as Orchestra;
89

10+
#[WithConfig('database.default', 'testing')]
911
class TestCase extends Orchestra
1012
{
13+
use WithWorkbench;
14+
1115
protected function setUp(): void
1216
{
1317
parent::setUp();
1418

1519
Artisan::call('native:install', ['--force' => true]);
1620
}
17-
18-
protected function getPackageProviders($app): array
19-
{
20-
return [
21-
ElectronServiceProvider::class,
22-
];
23-
}
24-
25-
public function getEnvironmentSetUp($app): void
26-
{
27-
config()->set('database.default', 'testing');
28-
}
2921
}

0 commit comments

Comments
 (0)