Skip to content

Commit

Permalink
TEST
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim-Webfox committed Jan 21, 2025
1 parent d775c5c commit 6b9c36d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 26 deletions.
1 change: 0 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
os: [ ubuntu-latest ]
php: [ 8.2 ]
laravel: [ 10.*,11.* ]
stability: [ prefer-lowest, prefer-stable ]

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

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ composer require webfox/laravel-backed-enums

### Make Command

Conveniently create a new laravel backed enum using the existing enum make command.
Creating a new Laravel Backed Enum is easy with the make:enum command.

#### Command:

```Bash
php artisan make:enum {name} {type?}
php artisan make:enum {name} --string # or --int
```

#### Arguments:
Expand Down
1 change: 0 additions & 1 deletion src/LaravelBackedEnumMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use InvalidArgumentException;
use Illuminate\Foundation\Console\EnumMakeCommand;


class LaravelBackedEnumMakeCommand extends EnumMakeCommand

Check failure on line 8 in src/LaravelBackedEnumMakeCommand.php

View workflow job for this annotation

GitHub Actions / phpstan

Class Webfox\LaravelBackedEnums\LaravelBackedEnumMakeCommand extends unknown class Illuminate\Foundation\Console\EnumMakeCommand.
{
protected $description = 'Create a new laravel backed enum';
Expand Down
34 changes: 12 additions & 22 deletions tests/MakeEnumCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,19 @@
use function Orchestra\Testbench\workbench_path;

it('can create an enum', function () {


/** @noinspection PhpFullyQualifiedNameUsageInspection */
if (!class_exists(\Illuminate\Foundation\Console\EnumMakeCommand::class)) return;

if (File::exists(workbench_path('app/Enums/TestEnum.php'))) {
File::delete(workbench_path('app/Enums/TestEnum.php'));
}
artisan('make:enum TestEnum -s')
->execute();





expect(workbench_path('app/Enums/TestEnum.php'))->toBeFile();
});
})
/** @noinspection PhpFullyQualifiedNameUsageInspection */
->skip(!class_exists(\Illuminate\Foundation\Console\EnumMakeCommand::class), "Laravel 11 only");

it('can make pure enum', function () {

/** @noinspection PhpFullyQualifiedNameUsageInspection */
if (!class_exists(\Illuminate\Foundation\Console\EnumMakeCommand::class)) return;

if (File::exists(workbench_path('app/Enums/PureEnum.php'))) {
File::delete(workbench_path('app/Enums/PureEnum.php'));
}
Expand All @@ -41,13 +31,12 @@
$actualContents = File::get(workbench_path('app/Enums/PureEnum.php'));

expect($actualContents)->toEqual($expectedContents);
});
})
/** @noinspection PhpFullyQualifiedNameUsageInspection */
->skip(!class_exists(\Illuminate\Foundation\Console\EnumMakeCommand::class), "Laravel 11 only");

it('can make string enum', function () {

/** @noinspection PhpFullyQualifiedNameUsageInspection */
if (!class_exists(\Illuminate\Foundation\Console\EnumMakeCommand::class)) return;

if (File::exists(workbench_path('app/Enums/StringEnum.php'))) {
File::delete(workbench_path('app/Enums/StringEnum.php'));
}
Expand All @@ -61,13 +50,12 @@
$actualContents = File::get(workbench_path('app/Enums/StringEnum.php'));

expect($actualContents)->toEqual($expectedContents);
});
})
/** @noinspection PhpFullyQualifiedNameUsageInspection */
->skip(!class_exists(\Illuminate\Foundation\Console\EnumMakeCommand::class), "Laravel 11 only");

it('can make int enum', function () {

/** @noinspection PhpFullyQualifiedNameUsageInspection */
if (!class_exists(\Illuminate\Foundation\Console\EnumMakeCommand::class)) return;

if (File::exists(workbench_path('app/Enums/IntEnum.php'))) {
File::delete(workbench_path('app/Enums/IntEnum.php'));
}
Expand All @@ -81,4 +69,6 @@
$actualContents = File::get(workbench_path('app/Enums/IntEnum.php'));

expect($actualContents)->toEqual($expectedContents);
});
})
/** @noinspection PhpFullyQualifiedNameUsageInspection */
->skip(!class_exists(\Illuminate\Foundation\Console\EnumMakeCommand::class), "Laravel 11 only");

0 comments on commit 6b9c36d

Please sign in to comment.