Skip to content
This repository was archived by the owner on Nov 11, 2022. It is now read-only.

Commit d0155d9

Browse files
committed
add Laravel 9 support
1 parent 1a00972 commit d0155d9

File tree

4 files changed

+29
-23
lines changed

4 files changed

+29
-23
lines changed

.github/workflows/run-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313
fail-fast: true
1414
matrix:
1515
os: [ubuntu-latest, windows-latest]
16-
php: [8.0]
17-
laravel: [8.*]
16+
php: [8.1, 8.0]
17+
laravel: [9.*]
1818
stability: [prefer-lowest, prefer-stable]
1919
include:
20-
- laravel: 8.*
21-
testbench: ^6.23
20+
- laravel: 9.*
21+
testbench: 7.*
2222

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

composer.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,18 @@
1818
"require": {
1919
"php": "^8.0",
2020
"spatie/laravel-package-tools": "^1.9.2",
21-
"illuminate/contracts": "^8.73"
21+
"illuminate/contracts": "^9.0"
2222
},
2323
"require-dev": {
24-
"nunomaduro/collision": "^5.10",
24+
"nunomaduro/collision": "^6.0",
2525
"nunomaduro/larastan": "^1.0",
26-
"orchestra/testbench": "^6.22",
26+
"orchestra/testbench": "^7.0",
2727
"pestphp/pest": "^1.21",
28-
"pestphp/pest-plugin-laravel": "^1.1",
28+
"pestphp/pest-plugin-laravel": "^1.2",
2929
"phpstan/extension-installer": "^1.1",
3030
"phpstan/phpstan-deprecation-rules": "^1.0",
3131
"phpstan/phpstan-phpunit": "^1.0",
32-
"phpunit/phpunit": "^9.5",
33-
"spatie/laravel-ray": "^1.26"
32+
"phpunit/phpunit": "^9.5.4"
3433
},
3534
"autoload": {
3635
"psr-4": {

src/Console/Concerns/InteractsWithConsoleCommands.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ trait InteractsWithConsoleCommands
1616
*/
1717
public function loopThroughNameArgumentWith(string $command): bool
1818
{
19-
collect($this->argument('name'))->each(function ($name, $key) use ($command) {
19+
/**
20+
* @var array $models
21+
*/
22+
$models = explode(' ', strval($this->argument('name')));
23+
24+
collect($models)->each(function ($name) use ($command) {
2025
$this->line("Generating {$name} class\n");
2126

2227
$this->call(
@@ -37,18 +42,6 @@ public function loopThroughNameArgumentWith(string $command): bool
3742
return true;
3843
}
3944

40-
/**
41-
* Get the console command arguments.
42-
*
43-
* @return array
44-
*/
45-
protected function getArguments(): array
46-
{
47-
return [
48-
['name', InputArgument::IS_ARRAY, 'The name of the class'],
49-
];
50-
}
51-
5245
/**
5346
* Get the list of options
5447
*

tests/Commands/ModelMakeCommandTest.php

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

3+
it('creates a new eloquent single model class', function () {
4+
$this->artisan('laracommand:make-model', [
5+
'name' => 'Category',
6+
])
7+
->assertExitCode(0);
8+
});
9+
10+
it('returns required error if the name was not provided', function () {
11+
$this->artisan('laracommand:make-model', [
12+
'name' => null,
13+
])
14+
->assertExitCode(0);
15+
});
16+
317
it('creates a new eloquent model class', function () {
418
$this->artisan('laracommand:make-model', [
519
'name' => 'Category Product',

0 commit comments

Comments
 (0)