Skip to content

Fix tests #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.2, 8.1]
laravel: [10.*]
php: [8.3, 8.2, 8.1]
laravel: [11.*, 10.*]
stability: [prefer-lowest, prefer-stable]
include:
- carbon: ^2.63
- laravel: 10.*
testbench: 8.*
carbon: ^2.63
- laravel: 11.*
php: 8.2
testbench: 9.*
- laravel: 11.*
php: 8.3
testbench: 9.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"guzzlehttp/guzzle": "^7.0",
"laravel/pint": "^1.0",
"nunomaduro/collision": "^7.9",
"nunomaduro/larastan": "^2.0.1",
"larastan/larastan": "^2.0.1",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-arch": "^2.0",
Expand Down
14 changes: 8 additions & 6 deletions src/Commands/FreshCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@

namespace Native\Laravel\Commands;

use Illuminate\Console\Command;
use Illuminate\Database\Console\Migrations\FreshCommand as BaseFreshCommand;
use Native\Laravel\NativeServiceProvider;

class FreshCommand extends Command
class FreshCommand extends BaseFreshCommand
{
protected $description = 'Run the database migrations in the NativePHP development environment';
protected $description = 'Drop all tables and re-run all migrations in the NativePHP development environment';

protected $signature = 'native:migrate fresh';
protected $signature = 'native:migrate:fresh';

public function handle()
{
unlink(config('nativephp-internal.database_path'));
$nativeServiceProvider = new NativeServiceProvider($this->laravel);

(new NativeServiceProvider($this->laravel))->rewriteDatabase();
$nativeServiceProvider->removeDatabase();

$nativeServiceProvider->rewriteDatabase();

$this->call('native:migrate');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Dialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function properties(array $properties): self
return $this;
}

public function asSheet(string $windowId = null): self
public function asSheet(?string $windowId = null): self
{
if (is_null($windowId)) {
$this->windowReference = Window::current()->id;
Expand Down
6 changes: 3 additions & 3 deletions src/Menu/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ public function label(string $label): self
return $this->add(new Label($label));
}

public function checkbox(string $label, bool $checked = false, string $hotkey = null): self
public function checkbox(string $label, bool $checked = false, ?string $hotkey = null): self
{
return $this->add(new Checkbox($label, $checked, $hotkey));
}

public function event(string $event, string $text, string $hotkey = null): self
public function event(string $event, string $text, ?string $hotkey = null): self
{
return $this->add(new Event($event, $text, $hotkey));
}

public function link(string $url, string $text, string $hotkey = null): self
public function link(string $url, string $text, ?string $hotkey = null): self
{
return $this->add(new Link($url, $text, $hotkey));
}
Expand Down
17 changes: 17 additions & 0 deletions src/NativeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Console\Application as Artisan;
use Illuminate\Support\Arr;
use Native\Laravel\Commands\FreshCommand;
use Native\Laravel\Commands\LoadPHPConfigurationCommand;
use Native\Laravel\Commands\LoadStartupConfigurationCommand;
use Native\Laravel\Commands\MigrateCommand;
Expand All @@ -21,6 +22,7 @@ public function configurePackage(Package $package): void
->name('nativephp')
->hasCommands([
MigrateCommand::class,
FreshCommand::class,
SeedDatabaseCommand::class,
MinifyApplicationCommand::class,
])
Expand Down Expand Up @@ -109,6 +111,21 @@ public function rewriteDatabase()
config(['database.default' => 'nativephp']);
}

public function removeDatabase()
{
$databasePath = config('nativephp-internal.database_path');

if (config('app.debug')) {
$databasePath = database_path('nativephp.sqlite');

if (! file_exists($databasePath)) {
return;
}
}

unlink($databasePath);
}

protected function configureDisks(): void
{
$disks = [
Expand Down
2 changes: 1 addition & 1 deletion src/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function printers(): array
})->toArray();
}

public function print(string $html, Printer $printer = null): void
public function print(string $html, ?Printer $printer = null): void
{
$this->client->post('system/print', [
'html' => $html,
Expand Down
4 changes: 2 additions & 2 deletions tests/Windows/WindowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
$window = Window::open()->invisibleFrameless();
$windowArray = $window->toArray();

expect($windowArray['frame'])->toBeTrue();
expect($windowArray['transparent'])->toBeTrue();
expect($windowArray['frame'])->toBeFalse();
expect($windowArray['transparency'])->toBeTrue();
expect($windowArray['focusable'])->toBeFalse();
expect($windowArray['hasShadow'])->toBeFalse();
});