From fe5eca62dc36c9087e3ca6d1131544873c93729b Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 5 Apr 2020 11:16:41 +0800 Subject: [PATCH 1/6] Add laravel 7.x support --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 025b9e4..5f64987 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ }, "require": { "php": ">=7.0.0", - "illuminate/support": "5.8.*||^6.0", + "illuminate/support": "5.8.*||^6.0||^7.0", "laravel/browser-kit-testing": "^5.0" }, "require-dev": { From 5c12266365617aa9b1186dd156c7c54236043322 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 5 Apr 2020 11:20:11 +0800 Subject: [PATCH 2/6] Update laravel/browser-kit-testing dependency --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5f64987..292f7ae 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "require": { "php": ">=7.0.0", "illuminate/support": "5.8.*||^6.0||^7.0", - "laravel/browser-kit-testing": "^5.0" + "laravel/browser-kit-testing": "^5.0||^6.x" }, "require-dev": { "orchestra/testbench": "~3.0" From 6b04ef013c86ca2019d7dc2a2dc34789fb5b301c Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 5 Apr 2020 11:45:04 +0800 Subject: [PATCH 3/6] Update removed trait --- src/GeneratorCommand.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/GeneratorCommand.php b/src/GeneratorCommand.php index 805aa46..4bcfb79 100644 --- a/src/GeneratorCommand.php +++ b/src/GeneratorCommand.php @@ -5,12 +5,10 @@ namespace Luthfi\CrudGenerator; use Illuminate\Support\Str; use Illuminate\Console\Command; use Illuminate\Filesystem\Filesystem; -use Illuminate\Console\DetectsApplicationNamespace; +use Illuminate\Container\Container; class GeneratorCommand extends Command { - use DetectsApplicationNamespace; - /** * The injected Filesystem class * @@ -130,4 +128,10 @@ class GeneratorCommand extends Command resource_path('views/'.str_replace('.', '/', config('simple-crud.default_layout_view')).'.blade.php') ); } + + + protected function getAppNamespace() + { + return Container::getInstance()->getNamespace(); + } } From 574e6aa952bf860402354d624e9a0b05232b25b5 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 5 Apr 2020 12:01:34 +0800 Subject: [PATCH 4/6] Fix invalid dependency version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 292f7ae..e632a35 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "require": { "php": ">=7.0.0", "illuminate/support": "5.8.*||^6.0||^7.0", - "laravel/browser-kit-testing": "^5.0||^6.x" + "laravel/browser-kit-testing": "^5.0||^6.0" }, "require-dev": { "orchestra/testbench": "~3.0" From 5ca6512d5fc3a724a2e8074ea987dc1697e3ae8d Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 5 Apr 2020 12:19:09 +0800 Subject: [PATCH 5/6] Update removed trait --- src/GeneratorCommand.php | 5 ++--- src/Generators/BaseGenerator.php | 11 +++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/GeneratorCommand.php b/src/GeneratorCommand.php index 4bcfb79..b8dced3 100644 --- a/src/GeneratorCommand.php +++ b/src/GeneratorCommand.php @@ -2,10 +2,10 @@ namespace Luthfi\CrudGenerator; -use Illuminate\Support\Str; use Illuminate\Console\Command; -use Illuminate\Filesystem\Filesystem; use Illuminate\Container\Container; +use Illuminate\Filesystem\Filesystem; +use Illuminate\Support\Str; class GeneratorCommand extends Command { @@ -129,7 +129,6 @@ class GeneratorCommand extends Command ); } - protected function getAppNamespace() { return Container::getInstance()->getNamespace(); diff --git a/src/Generators/BaseGenerator.php b/src/Generators/BaseGenerator.php index d129a0d..e532ffd 100644 --- a/src/Generators/BaseGenerator.php +++ b/src/Generators/BaseGenerator.php @@ -2,18 +2,16 @@ namespace Luthfi\CrudGenerator\Generators; +use Illuminate\Container\Container; use Illuminate\Filesystem\Filesystem; -use Luthfi\CrudGenerator\GeneratorCommand; -use Illuminate\Console\DetectsApplicationNamespace; use Luthfi\CrudGenerator\Contracts\Generator as GeneratorContract; +use Luthfi\CrudGenerator\GeneratorCommand; /** * Base Generator Class */ abstract class BaseGenerator implements GeneratorContract { - use DetectsApplicationNamespace; - /** * The injected Filesystem class * @@ -130,4 +128,9 @@ abstract class BaseGenerator implements GeneratorContract { return $this->command->getName() == 'make:crud-api'; } + + protected function getAppNamespace() + { + return Container::getInstance()->getNamespace(); + } } From cb881da6ccf4bdce708d3ed763b1dbc99a0493f9 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 5 Apr 2020 14:27:09 +0800 Subject: [PATCH 6/6] Update api test stubs to replace removed test method --- src/stubs/testcases/feature/api.stub | 12 +++++------ .../Generators/Api/ApiFeatureTestGeneratorTest.php | 24 +++++++++++----------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/stubs/testcases/feature/api.stub b/src/stubs/testcases/feature/api.stub index c32bc5d..ea35101 100644 --- a/src/stubs/testcases/feature/api.stub +++ b/src/stubs/testcases/feature/api.stub @@ -70,7 +70,7 @@ class ManageMasterTest extends TestCase ); $this->seeStatusCode(422); - $this->seeJsonSubset(['errors' => ['name' => []]]); + $this->seeJsonStructure(['errors' => ['name']]); } /** @test */ @@ -87,7 +87,7 @@ class ManageMasterTest extends TestCase ); $this->seeStatusCode(422); - $this->seeJsonSubset(['errors' => ['name' => []]]); + $this->seeJsonStructure(['errors' => ['name']]); } /** @test */ @@ -104,7 +104,7 @@ class ManageMasterTest extends TestCase ); $this->seeStatusCode(422); - $this->seeJsonSubset(['errors' => ['description' => []]]); + $this->seeJsonStructure(['errors' => ['description']]); } /** @test */ @@ -169,7 +169,7 @@ class ManageMasterTest extends TestCase ); $this->seeStatusCode(422); - $this->seeJsonSubset(['errors' => ['name' => []]]); + $this->seeJsonStructure(['errors' => ['name']]); } /** @test */ @@ -187,7 +187,7 @@ class ManageMasterTest extends TestCase ); $this->seeStatusCode(422); - $this->seeJsonSubset(['errors' => ['name' => []]]); + $this->seeJsonStructure(['errors' => ['name']]); } /** @test */ @@ -205,7 +205,7 @@ class ManageMasterTest extends TestCase ); $this->seeStatusCode(422); - $this->seeJsonSubset(['errors' => ['description' => []]]); + $this->seeJsonStructure(['errors' => ['description']]); } /** @test */ diff --git a/tests/Generators/Api/ApiFeatureTestGeneratorTest.php b/tests/Generators/Api/ApiFeatureTestGeneratorTest.php index 7696f7b..a93c1fe 100644 --- a/tests/Generators/Api/ApiFeatureTestGeneratorTest.php +++ b/tests/Generators/Api/ApiFeatureTestGeneratorTest.php @@ -84,7 +84,7 @@ class Manage{$this->model_name}Test extends TestCase ); \$this->seeStatusCode(422); - \$this->seeJsonSubset(['errors' => ['name' => []]]); + \$this->seeJsonStructure(['errors' => ['name']]); } /** @test */ @@ -101,7 +101,7 @@ class Manage{$this->model_name}Test extends TestCase ); \$this->seeStatusCode(422); - \$this->seeJsonSubset(['errors' => ['name' => []]]); + \$this->seeJsonStructure(['errors' => ['name']]); } /** @test */ @@ -118,7 +118,7 @@ class Manage{$this->model_name}Test extends TestCase ); \$this->seeStatusCode(422); - \$this->seeJsonSubset(['errors' => ['description' => []]]); + \$this->seeJsonStructure(['errors' => ['description']]); } /** @test */ @@ -183,7 +183,7 @@ class Manage{$this->model_name}Test extends TestCase ); \$this->seeStatusCode(422); - \$this->seeJsonSubset(['errors' => ['name' => []]]); + \$this->seeJsonStructure(['errors' => ['name']]); } /** @test */ @@ -201,7 +201,7 @@ class Manage{$this->model_name}Test extends TestCase ); \$this->seeStatusCode(422); - \$this->seeJsonSubset(['errors' => ['name' => []]]); + \$this->seeJsonStructure(['errors' => ['name']]); } /** @test */ @@ -219,7 +219,7 @@ class Manage{$this->model_name}Test extends TestCase ); \$this->seeStatusCode(422); - \$this->seeJsonSubset(['errors' => ['description' => []]]); + \$this->seeJsonStructure(['errors' => ['description']]); } /** @test */ @@ -329,7 +329,7 @@ class Manage{$this->model_name}Test extends TestCase ); \$this->seeStatusCode(422); - \$this->seeJsonSubset(['errors' => ['name' => []]]); + \$this->seeJsonStructure(['errors' => ['name']]); } /** @test */ @@ -346,7 +346,7 @@ class Manage{$this->model_name}Test extends TestCase ); \$this->seeStatusCode(422); - \$this->seeJsonSubset(['errors' => ['name' => []]]); + \$this->seeJsonStructure(['errors' => ['name']]); } /** @test */ @@ -363,7 +363,7 @@ class Manage{$this->model_name}Test extends TestCase ); \$this->seeStatusCode(422); - \$this->seeJsonSubset(['errors' => ['description' => []]]); + \$this->seeJsonStructure(['errors' => ['description']]); } /** @test */ @@ -428,7 +428,7 @@ class Manage{$this->model_name}Test extends TestCase ); \$this->seeStatusCode(422); - \$this->seeJsonSubset(['errors' => ['name' => []]]); + \$this->seeJsonStructure(['errors' => ['name']]); } /** @test */ @@ -446,7 +446,7 @@ class Manage{$this->model_name}Test extends TestCase ); \$this->seeStatusCode(422); - \$this->seeJsonSubset(['errors' => ['name' => []]]); + \$this->seeJsonStructure(['errors' => ['name']]); } /** @test */ @@ -464,7 +464,7 @@ class Manage{$this->model_name}Test extends TestCase ); \$this->seeStatusCode(422); - \$this->seeJsonSubset(['errors' => ['description' => []]]); + \$this->seeJsonStructure(['errors' => ['description']]); } /** @test */