Browse Source

Merge pull request #21 from nafiesl/laravel-7-support

Add Laravel 7 support
tags/1.4.0^0 1.4.0
Nafies Luthfi 6 years ago
committed by GitHub
parent
commit
f7579a24c7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      composer.json
  2. 11
      src/GeneratorCommand.php
  3. 11
      src/Generators/BaseGenerator.php
  4. 12
      src/stubs/testcases/feature/api.stub
  5. 24
      tests/Generators/Api/ApiFeatureTestGeneratorTest.php

4
composer.json

@ -21,8 +21,8 @@
},
"require": {
"php": ">=7.0.0",
"illuminate/support": "5.8.*||^6.0",
"laravel/browser-kit-testing": "^5.0"
"illuminate/support": "5.8.*||^6.0||^7.0",
"laravel/browser-kit-testing": "^5.0||^6.0"
},
"require-dev": {
"orchestra/testbench": "~3.0"

11
src/GeneratorCommand.php

@ -2,15 +2,13 @@
namespace Luthfi\CrudGenerator;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Illuminate\Container\Container;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Console\DetectsApplicationNamespace;
use Illuminate\Support\Str;
class GeneratorCommand extends Command
{
use DetectsApplicationNamespace;
/**
* The injected Filesystem class
*
@ -130,4 +128,9 @@ class GeneratorCommand extends Command
resource_path('views/'.str_replace('.', '/', config('simple-crud.default_layout_view')).'.blade.php')
);
}
protected function getAppNamespace()
{
return Container::getInstance()->getNamespace();
}
}

11
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();
}
}

12
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 */

24
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 */

Loading…
Cancel
Save