|
|
|
@ -11,16 +11,16 @@ class CrudApiMakeCommandTest extends TestCase |
|
|
|
{ |
|
|
|
$this->artisan('make:crud-api', ['name' => $this->model_name, '--no-interaction' => true]); |
|
|
|
|
|
|
|
$this->assertNotContains("{$this->model_name} model already exists.", app(Kernel::class)->output()); |
|
|
|
$this->assertStringNotContainsString("{$this->model_name} model already exists.", app(Kernel::class)->output()); |
|
|
|
|
|
|
|
$this->assertFileExists(app_path($this->model_name.'.php')); |
|
|
|
$this->assertFileExists(app_path('Models/'.$this->model_name.'.php')); |
|
|
|
$this->assertFileExists(app_path("Http/Controllers/Api/{$this->model_name}Controller.php")); |
|
|
|
|
|
|
|
$migrationFilePath = database_path('migrations/'.date('Y_m_d_His').'_create_'.$this->table_name.'_table.php'); |
|
|
|
$this->assertFileExists($migrationFilePath); |
|
|
|
|
|
|
|
$this->assertFileNotExists(resource_path("views/{$this->table_name}/index.blade.php")); |
|
|
|
$this->assertFileNotExists(resource_path("views/{$this->table_name}/forms.blade.php")); |
|
|
|
$this->assertFileDoesNotExist(resource_path("views/{$this->table_name}/index.blade.php")); |
|
|
|
$this->assertFileDoesNotExist(resource_path("views/{$this->table_name}/forms.blade.php")); |
|
|
|
|
|
|
|
$localeConfig = config('app.locale'); |
|
|
|
$this->assertFileExists(resource_path("lang/{$localeConfig}/{$this->lang_name}.php")); |
|
|
|
@ -39,22 +39,21 @@ class CrudApiMakeCommandTest extends TestCase |
|
|
|
$this->artisan('make:model', ['name' => $this->model_name, '--no-interaction' => true]); |
|
|
|
$this->artisan('make:crud-api', ['name' => $this->model_name, '--no-interaction' => true]); |
|
|
|
|
|
|
|
$this->assertContains("We will use existing {$this->model_name} model.", app(Kernel::class)->output()); |
|
|
|
|
|
|
|
$this->assertFileExists(app_path($this->model_name.'.php')); |
|
|
|
$this->assertStringContainsString("We will use existing {$this->model_name} model.", app(Kernel::class)->output()); |
|
|
|
$this->assertFileExists(app_path('Models/'.$this->model_name.'.php')); |
|
|
|
$this->assertFileExists(app_path("Http/Controllers/Api/{$this->model_name}Controller.php")); |
|
|
|
|
|
|
|
$migrationFilePath = database_path('migrations/'.date('Y_m_d_His').'_create_'.$this->table_name.'_table.php'); |
|
|
|
$this->assertFileNotExists($migrationFilePath); |
|
|
|
$this->assertFileDoesNotExist($migrationFilePath); |
|
|
|
|
|
|
|
$localeConfig = config('app.locale'); |
|
|
|
$this->assertFileNotExists(resource_path("lang/{$localeConfig}/{$this->lang_name}.php")); |
|
|
|
$this->assertFileDoesNotExist(resource_path("lang/{$localeConfig}/{$this->lang_name}.php")); |
|
|
|
|
|
|
|
$this->assertFileNotExists(base_path("routes/web.php")); |
|
|
|
$this->assertFileNotExists(app_path("Policies/{$this->model_name}Policy.php")); |
|
|
|
$this->assertFileNotExists(database_path("factories/{$this->model_name}Factory.php")); |
|
|
|
$this->assertFileNotExists(base_path("tests/Unit/Models/{$this->model_name}Test.php")); |
|
|
|
$this->assertFileNotExists(base_path("tests/Unit/Policies/{$this->model_name}PolicyTest.php")); |
|
|
|
$this->assertFileDoesNotExist(base_path("routes/web.php")); |
|
|
|
$this->assertFileDoesNotExist(app_path("Policies/{$this->model_name}Policy.php")); |
|
|
|
$this->assertFileDoesNotExist(database_path("factories/{$this->model_name}Factory.php")); |
|
|
|
$this->assertFileDoesNotExist(base_path("tests/Unit/Models/{$this->model_name}Test.php")); |
|
|
|
$this->assertFileDoesNotExist(base_path("tests/Unit/Policies/{$this->model_name}PolicyTest.php")); |
|
|
|
$this->assertFileExists(base_path("tests/Feature/Api/Manage{$this->model_name}Test.php")); |
|
|
|
} |
|
|
|
|
|
|
|
@ -64,24 +63,24 @@ class CrudApiMakeCommandTest extends TestCase |
|
|
|
$this->artisan('make:model', ['name' => 'Entities/Projects/Problem', '--no-interaction' => true]); |
|
|
|
$this->artisan('make:crud-api', ['name' => 'Entities/Projects/Problem', '--no-interaction' => true]); |
|
|
|
|
|
|
|
$this->assertContains("We will use existing Problem model.", app(Kernel::class)->output()); |
|
|
|
$this->assertStringContainsString("We will use existing Problem model.", app(Kernel::class)->output()); |
|
|
|
|
|
|
|
$this->assertFileExists(app_path('Entities/Projects/Problem.php')); |
|
|
|
$this->assertFileExists(app_path("Http/Controllers/Api/ProblemController.php")); |
|
|
|
|
|
|
|
$migrationFilePath = database_path('migrations/'.date('Y_m_d_His').'_create_problems_table.php'); |
|
|
|
$this->assertFileNotExists($migrationFilePath); |
|
|
|
$this->assertFileDoesNotExist($migrationFilePath); |
|
|
|
|
|
|
|
$this->assertFileNotExists(resource_path("views/problems/index.blade.php")); |
|
|
|
$this->assertFileNotExists(resource_path("views/problems/forms.blade.php")); |
|
|
|
$this->assertFileDoesNotExist(resource_path("views/problems/index.blade.php")); |
|
|
|
$this->assertFileDoesNotExist(resource_path("views/problems/forms.blade.php")); |
|
|
|
|
|
|
|
$localeConfig = config('app.locale'); |
|
|
|
$this->assertFileNotExists(resource_path("lang/{$localeConfig}/{$this->lang_name}.php")); |
|
|
|
$this->assertFileDoesNotExist(resource_path("lang/{$localeConfig}/{$this->lang_name}.php")); |
|
|
|
|
|
|
|
$this->assertFileNotExists(app_path("Policies/ProblemPolicy.php")); |
|
|
|
$this->assertFileNotExists(database_path("factories/ProblemFactory.php")); |
|
|
|
$this->assertFileNotExists(base_path("tests/Unit/Models/ProblemTest.php")); |
|
|
|
$this->assertFileNotExists(base_path("tests/Unit/Policies/ProblemPolicyTest.php")); |
|
|
|
$this->assertFileDoesNotExist(app_path("Policies/ProblemPolicy.php")); |
|
|
|
$this->assertFileDoesNotExist(database_path("factories/ProblemFactory.php")); |
|
|
|
$this->assertFileDoesNotExist(base_path("tests/Unit/Models/ProblemTest.php")); |
|
|
|
$this->assertFileDoesNotExist(base_path("tests/Unit/Policies/ProblemPolicyTest.php")); |
|
|
|
$this->assertFileExists(base_path("tests/Feature/Api/ManageProblemTest.php")); |
|
|
|
|
|
|
|
$this->removeFileOrDir(app_path('Entities/Projects')); |
|
|
|
@ -101,7 +100,7 @@ class CrudApiMakeCommandTest extends TestCase |
|
|
|
|
|
|
|
$this->artisan('make:crud-api', ['name' => $inputName, '--no-interaction' => true]); |
|
|
|
|
|
|
|
$this->assertNotContains("{$modelName} model already exists.", app(Kernel::class)->output()); |
|
|
|
$this->assertStringNotContainsString("{$modelName} model already exists.", app(Kernel::class)->output()); |
|
|
|
|
|
|
|
$this->assertFileExists(app_path($modelPath.'/'.$modelName.'.php')); |
|
|
|
$this->assertFileExists(app_path("Http/Controllers/Api/{$modelName}Controller.php")); |
|
|
|
@ -109,8 +108,8 @@ class CrudApiMakeCommandTest extends TestCase |
|
|
|
$migrationFilePath = database_path('migrations/'.date('Y_m_d_His').'_create_'.$tableName.'_table.php'); |
|
|
|
$this->assertFileExists($migrationFilePath); |
|
|
|
|
|
|
|
$this->assertFileNotExists(resource_path("views/{$tableName}/index.blade.php")); |
|
|
|
$this->assertFileNotExists(resource_path("views/{$tableName}/forms.blade.php")); |
|
|
|
$this->assertFileDoesNotExist(resource_path("views/{$tableName}/index.blade.php")); |
|
|
|
$this->assertFileDoesNotExist(resource_path("views/{$tableName}/forms.blade.php")); |
|
|
|
|
|
|
|
$localeConfig = config('app.locale'); |
|
|
|
$this->assertFileExists(resource_path("lang/{$localeConfig}/{$langName}.php")); |
|
|
|
@ -135,7 +134,7 @@ class CrudApiMakeCommandTest extends TestCase |
|
|
|
|
|
|
|
$this->artisan('make:crud-api', ['name' => $inputName, '--parent' => $parentName, '--no-interaction' => true]); |
|
|
|
|
|
|
|
$this->assertNotContains("{$modelName} model already exists.", app(Kernel::class)->output()); |
|
|
|
$this->assertStringNotContainsString("{$modelName} model already exists.", app(Kernel::class)->output()); |
|
|
|
|
|
|
|
$this->assertFileExists(app_path($modelPath.'/'.$modelName.'.php')); |
|
|
|
$this->assertFileExists(app_path("Http/Controllers/Api/{$parentName}/{$modelName}Controller.php")); |
|
|
|
@ -143,8 +142,8 @@ class CrudApiMakeCommandTest extends TestCase |
|
|
|
$migrationFilePath = database_path('migrations/'.date('Y_m_d_His').'_create_'.$tableName.'_table.php'); |
|
|
|
$this->assertFileExists($migrationFilePath); |
|
|
|
|
|
|
|
$this->assertFileNotExists(resource_path("views/{$tableName}/index.blade.php")); |
|
|
|
$this->assertFileNotExists(resource_path("views/{$tableName}/forms.blade.php")); |
|
|
|
$this->assertFileDoesNotExist(resource_path("views/{$tableName}/index.blade.php")); |
|
|
|
$this->assertFileDoesNotExist(resource_path("views/{$tableName}/forms.blade.php")); |
|
|
|
|
|
|
|
$localeConfig = config('app.locale'); |
|
|
|
$this->assertFileExists(resource_path("lang/{$localeConfig}/{$langName}.php")); |
|
|
|
|