From e5d5a7df571474ff67330833255c6a6ebd2e7308 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 20 Aug 2017 19:21:24 +0800 Subject: [PATCH] Added Controller class, feature test class and model unit test class --- src/CrudMake.php | 4 ++++ tests/CrudMakeCommandTest.php | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/CrudMake.php b/src/CrudMake.php index 62cdf7c..652b640 100644 --- a/src/CrudMake.php +++ b/src/CrudMake.php @@ -33,6 +33,10 @@ class CrudMake extends Command $this->callSilent('make:model', ['name' => $model]); $this->info($model.' model generated.'); + $this->callSilent('make:controller', ['name' => $pluralModel.'Controller']); + $this->info($pluralModel.'Controller generated.'); + $this->callSilent('make:test', ['name' => 'Manage'.$pluralModel.'Test']); + $this->callSilent('make:test', ['name' => 'Models/'.$model.'Test', '--unit' => true]); $this->info('CRUD files generated successfully!'); } diff --git a/tests/CrudMakeCommandTest.php b/tests/CrudMakeCommandTest.php index 2253f8c..feea459 100644 --- a/tests/CrudMakeCommandTest.php +++ b/tests/CrudMakeCommandTest.php @@ -15,16 +15,16 @@ class CrudMakeCommandTest extends TestCase $this->artisan('make:crud', ['name' => 'Test', '--no-interaction' => true]); $this->assertFileExists(app_path('Test.php')); - // $this->assertFileExists(app_path('Http/Controllers/TestsController.php')); + $this->assertFileExists(app_path('Http/Controllers/TestsController.php')); // $this->assertFileExists(resource_path('views/tests/index.blade.php')); // $this->assertFileExists(resource_path('views/tests/forms.blade.php')); - // $this->assertFileExists(base_path('tests/Feature/ManageTestsTest.php')); - // $this->assertFileExists(base_path('tests/Unit/Models/TestTest.php')); + $this->assertFileExists(base_path('tests/Feature/ManageTestsTest.php')); + $this->assertFileExists(base_path('tests/Unit/Models/TestTest.php')); exec('rm '.app_path('Test.php')); - // exec('rm -r '.app_path('Http/Controllers')); + exec('rm -r '.app_path('Http')); // exec('rm -r '.resource_path('views/tests')); - // exec('rm '.base_path('tests/Feature/ManageTestsTest.php')); - // exec('rm '.base_path('tests/Unit/ModelsTestTest.php')); + exec('rm -r '.base_path('tests/Feature')); + exec('rm -r '.base_path('tests/Unit')); } }