From 5b96a31c83fd4d6df940dcbbe4bfb59be9b28d76 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Thu, 23 Aug 2018 08:37:41 +0800 Subject: [PATCH] Change FeatureTest name convention to singular --- src/Generators/FeatureTestGenerator.php | 4 ++-- src/stubs/testcases/feature/api.stub | 2 +- src/stubs/testcases/feature/full.stub | 2 +- src/stubs/testcases/feature/simple.stub | 2 +- tests/CommandOptions/TestsOnlyOptionsTest.php | 6 +++--- tests/CrudApiMakeCommandTest.php | 10 +++++----- tests/CrudMakeCommandTest.php | 10 +++++----- tests/CrudSimpleMakeCommandTest.php | 10 +++++----- tests/Generators/Api/ApiFeatureTestGeneratorTest.php | 12 ++++++------ tests/Generators/FeatureTestGeneratorTest.php | 12 ++++++------ tests/Generators/Simple/FeatureTestGeneratorTest.php | 12 ++++++------ 11 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/Generators/FeatureTestGenerator.php b/src/Generators/FeatureTestGenerator.php index 5742d9c..4d160b5 100644 --- a/src/Generators/FeatureTestGenerator.php +++ b/src/Generators/FeatureTestGenerator.php @@ -23,11 +23,11 @@ class FeatureTestGenerator extends BaseGenerator $featureTestPath = $this->makeDirectory(base_path($featureTestPath)); $this->generateFile( - "{$featureTestPath}/Manage{$this->modelNames['plural_model_name']}Test.php", + "{$featureTestPath}/Manage{$this->modelNames['model_name']}Test.php", $this->getContent('testcases/feature/'.$type) ); - $this->command->info('Manage'.$this->modelNames['plural_model_name'].'Test generated.'); + $this->command->info('Manage'.$this->modelNames['model_name'].'Test generated.'); } /** diff --git a/src/stubs/testcases/feature/api.stub b/src/stubs/testcases/feature/api.stub index c7ba1ac..586f9d1 100644 --- a/src/stubs/testcases/feature/api.stub +++ b/src/stubs/testcases/feature/api.stub @@ -6,7 +6,7 @@ use fullMstr; use Tests\BrowserKitTest as TestCase; use Illuminate\Foundation\Testing\DatabaseMigrations; -class ManageMastersTest extends TestCase +class ManageMasterTest extends TestCase { use DatabaseMigrations; diff --git a/src/stubs/testcases/feature/full.stub b/src/stubs/testcases/feature/full.stub index 395c5b9..16cf7c1 100644 --- a/src/stubs/testcases/feature/full.stub +++ b/src/stubs/testcases/feature/full.stub @@ -6,7 +6,7 @@ use fullMstr; use Tests\BrowserKitTest as TestCase; use Illuminate\Foundation\Testing\DatabaseMigrations; -class ManageMastersTest extends TestCase +class ManageMasterTest extends TestCase { use DatabaseMigrations; diff --git a/src/stubs/testcases/feature/simple.stub b/src/stubs/testcases/feature/simple.stub index 0e5ea37..6503141 100644 --- a/src/stubs/testcases/feature/simple.stub +++ b/src/stubs/testcases/feature/simple.stub @@ -6,7 +6,7 @@ use fullMstr; use Tests\BrowserKitTest as TestCase; use Illuminate\Foundation\Testing\DatabaseMigrations; -class ManageMastersTest extends TestCase +class ManageMasterTest extends TestCase { use DatabaseMigrations; diff --git a/tests/CommandOptions/TestsOnlyOptionsTest.php b/tests/CommandOptions/TestsOnlyOptionsTest.php index 705e39b..b89f2ec 100644 --- a/tests/CommandOptions/TestsOnlyOptionsTest.php +++ b/tests/CommandOptions/TestsOnlyOptionsTest.php @@ -2,8 +2,8 @@ namespace Tests\CommandOptions; -use Illuminate\Contracts\Console\Kernel; use Tests\TestCase; +use Illuminate\Contracts\Console\Kernel; class TestOnlyOptionsTest extends TestCase { @@ -20,7 +20,7 @@ class TestOnlyOptionsTest extends TestCase $this->assertNotContains("{$this->model_name} model already exists.", $output); $this->assertFileNotExists(app_path($this->model_name.'.php')); - $this->assertFileNotExists(app_path("Http/Controllers/{$this->plural_model_name}Controller.php")); + $this->assertFileNotExists(app_path("Http/Controllers/{$this->model_name}Controller.php")); $migrationFilePath = database_path('migrations/'.date('Y_m_d_His').'_create_'.$this->table_name.'_table.php'); $this->assertFileNotExists($migrationFilePath); @@ -37,7 +37,7 @@ class TestOnlyOptionsTest extends TestCase $this->assertFileExists(base_path("tests/Unit/Models/{$this->model_name}Test.php")); $this->assertFileExists(base_path("tests/Unit/Policies/{$this->model_name}PolicyTest.php")); - $this->assertFileExists(base_path("tests/Feature/Manage{$this->plural_model_name}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Manage{$this->model_name}Test.php")); $this->assertContains('Test files generated successfully!', $output); } diff --git a/tests/CrudApiMakeCommandTest.php b/tests/CrudApiMakeCommandTest.php index f7f13be..807dea0 100644 --- a/tests/CrudApiMakeCommandTest.php +++ b/tests/CrudApiMakeCommandTest.php @@ -29,7 +29,7 @@ class CrudApiMakeCommandTest extends TestCase $this->assertFileExists(app_path("Policies/{$this->model_name}Policy.php")); $this->assertFileExists(database_path("factories/{$this->model_name}Factory.php")); $this->assertFileExists(base_path("tests/Unit/Models/{$this->model_name}Test.php")); - $this->assertFileExists(base_path("tests/Feature/Api/Manage{$this->plural_model_name}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Api/Manage{$this->model_name}Test.php")); } /** @test */ @@ -53,7 +53,7 @@ class CrudApiMakeCommandTest extends TestCase $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->assertFileExists(base_path("tests/Feature/Api/Manage{$this->plural_model_name}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Api/Manage{$this->model_name}Test.php")); } /** @test */ @@ -79,7 +79,7 @@ class CrudApiMakeCommandTest extends TestCase $this->assertFileNotExists(app_path("Policies/ProblemPolicy.php")); $this->assertFileNotExists(database_path("factories/ProblemFactory.php")); $this->assertFileNotExists(base_path("tests/Unit/Models/ProblemTest.php")); - $this->assertFileExists(base_path("tests/Feature/Api/ManageProblemsTest.php")); + $this->assertFileExists(base_path("tests/Feature/Api/ManageProblemTest.php")); $this->removeFileOrDir(app_path('Entities/Projects')); $this->removeFileOrDir(resource_path('views/problems')); @@ -115,7 +115,7 @@ class CrudApiMakeCommandTest extends TestCase $this->assertFileExists(app_path("Policies/{$modelName}Policy.php")); $this->assertFileExists(database_path("factories/{$modelName}Factory.php")); $this->assertFileExists(base_path("tests/Unit/Models/{$modelName}Test.php")); - $this->assertFileExists(base_path("tests/Feature/Api/Manage{$pluralModelName}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Api/Manage{$modelName}Test.php")); } /** @test */ @@ -148,6 +148,6 @@ class CrudApiMakeCommandTest extends TestCase $this->assertFileExists(database_path("factories/{$modelName}Factory.php")); $this->assertFileExists(base_path("tests/Unit/Models/{$modelName}Test.php")); $this->assertFileExists(app_path("Policies/{$parentName}/{$modelName}Policy.php")); - $this->assertFileExists(base_path("tests/Feature/Api/Manage{$pluralModelName}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Api/Manage{$modelName}Test.php")); } } diff --git a/tests/CrudMakeCommandTest.php b/tests/CrudMakeCommandTest.php index c43a202..2a0e522 100644 --- a/tests/CrudMakeCommandTest.php +++ b/tests/CrudMakeCommandTest.php @@ -31,7 +31,7 @@ class CrudMakeCommandTest extends TestCase $this->assertFileExists(app_path("Policies/{$this->model_name}Policy.php")); $this->assertFileExists(database_path("factories/{$this->model_name}Factory.php")); $this->assertFileExists(base_path("tests/Unit/Models/{$this->model_name}Test.php")); - $this->assertFileExists(base_path("tests/Feature/Manage{$this->plural_model_name}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Manage{$this->model_name}Test.php")); } /** @test */ @@ -60,7 +60,7 @@ class CrudMakeCommandTest extends TestCase $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/Feature/Manage{$this->plural_model_name}Test.php")); + $this->assertFileNotExists(base_path("tests/Feature/Manage{$this->model_name}Test.php")); } /** @test */ @@ -88,7 +88,7 @@ class CrudMakeCommandTest extends TestCase $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/Feature/ManageProblemsTest.php")); + $this->assertFileNotExists(base_path("tests/Feature/ManageProblemTest.php")); $this->removeFileOrDir(app_path('Entities/Projects')); $this->removeFileOrDir(resource_path('views/problems')); @@ -126,7 +126,7 @@ class CrudMakeCommandTest extends TestCase $this->assertFileExists(app_path("Policies/{$modelName}Policy.php")); $this->assertFileExists(database_path("factories/{$modelName}Factory.php")); $this->assertFileExists(base_path("tests/Unit/Models/{$modelName}Test.php")); - $this->assertFileExists(base_path("tests/Feature/Manage{$pluralModelName}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Manage{$modelName}Test.php")); } /** @test */ @@ -161,6 +161,6 @@ class CrudMakeCommandTest extends TestCase $this->assertFileExists(database_path("factories/{$modelName}Factory.php")); $this->assertFileExists(base_path("tests/Unit/Models/{$modelName}Test.php")); $this->assertFileExists(app_path("Policies/{$parentName}/{$modelName}Policy.php")); - $this->assertFileExists(base_path("tests/Feature/Manage{$pluralModelName}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Manage{$modelName}Test.php")); } } diff --git a/tests/CrudSimpleMakeCommandTest.php b/tests/CrudSimpleMakeCommandTest.php index d0eb307..14bd5c9 100644 --- a/tests/CrudSimpleMakeCommandTest.php +++ b/tests/CrudSimpleMakeCommandTest.php @@ -29,7 +29,7 @@ class CrudSimpleCommandTest extends TestCase $this->assertFileExists(app_path("Policies/{$this->model_name}Policy.php")); $this->assertFileExists(database_path("factories/{$this->model_name}Factory.php")); $this->assertFileExists(base_path("tests/Unit/Models/{$this->model_name}Test.php")); - $this->assertFileExists(base_path("tests/Feature/Manage{$this->plural_model_name}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Manage{$this->model_name}Test.php")); } /** @test */ @@ -56,7 +56,7 @@ class CrudSimpleCommandTest extends TestCase $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/Feature/Manage{$this->plural_model_name}Test.php")); + $this->assertFileNotExists(base_path("tests/Feature/Manage{$this->model_name}Test.php")); } /** @test */ @@ -82,7 +82,7 @@ class CrudSimpleCommandTest extends TestCase $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/Feature/ManageProblemsTest.php")); + $this->assertFileNotExists(base_path("tests/Feature/ManageProblemTest.php")); $this->removeFileOrDir(app_path('Entities/Projects')); $this->removeFileOrDir(resource_path('views/problems')); @@ -118,7 +118,7 @@ class CrudSimpleCommandTest extends TestCase $this->assertFileExists(app_path("Policies/{$modelName}Policy.php")); $this->assertFileExists(database_path("factories/{$modelName}Factory.php")); $this->assertFileExists(base_path("tests/Unit/Models/{$modelName}Test.php")); - $this->assertFileExists(base_path("tests/Feature/Manage{$pluralModelName}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Manage{$modelName}Test.php")); } /** @test */ @@ -151,6 +151,6 @@ class CrudSimpleCommandTest extends TestCase $this->assertFileExists(database_path("factories/{$modelName}Factory.php")); $this->assertFileExists(base_path("tests/Unit/Models/{$modelName}Test.php")); $this->assertFileExists(app_path("Policies/{$parentName}/{$modelName}Policy.php")); - $this->assertFileExists(base_path("tests/Feature/Manage{$pluralModelName}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Manage{$modelName}Test.php")); } } diff --git a/tests/Generators/Api/ApiFeatureTestGeneratorTest.php b/tests/Generators/Api/ApiFeatureTestGeneratorTest.php index 0ae5739..499ee34 100644 --- a/tests/Generators/Api/ApiFeatureTestGeneratorTest.php +++ b/tests/Generators/Api/ApiFeatureTestGeneratorTest.php @@ -11,7 +11,7 @@ class ApiFeatureTestGeneratorTest extends TestCase { $this->artisan('make:crud-api', ['name' => $this->model_name, '--no-interaction' => true]); - $this->assertFileExists(base_path("tests/Feature/Api/Manage{$this->plural_model_name}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Api/Manage{$this->model_name}Test.php")); $featureTestClassContent = "full_model_name}; use Tests\BrowserKitTest as TestCase; use Illuminate\Foundation\Testing\DatabaseMigrations; -class Manage{$this->plural_model_name}Test extends TestCase +class Manage{$this->model_name}Test extends TestCase { use DatabaseMigrations; @@ -124,7 +124,7 @@ class Manage{$this->plural_model_name}Test extends TestCase } } "; - $this->assertEquals($featureTestClassContent, file_get_contents(base_path("tests/Feature/Api/Manage{$this->plural_model_name}Test.php"))); + $this->assertEquals($featureTestClassContent, file_get_contents(base_path("tests/Feature/Api/Manage{$this->model_name}Test.php"))); } /** @test */ @@ -135,7 +135,7 @@ class Manage{$this->plural_model_name}Test extends TestCase $this->artisan('make:crud-api', ['name' => $this->model_name, '--no-interaction' => true]); - $this->assertFileExists(base_path("tests/Feature/Api/Manage{$this->plural_model_name}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Api/Manage{$this->model_name}Test.php")); $featureTestClassContent = "full_model_name}; use Tests\TestCase as TestCase; use Illuminate\Foundation\Testing\DatabaseMigrations; -class Manage{$this->plural_model_name}Test extends TestCase +class Manage{$this->model_name}Test extends TestCase { use DatabaseMigrations; @@ -248,6 +248,6 @@ class Manage{$this->plural_model_name}Test extends TestCase } } "; - $this->assertEquals($featureTestClassContent, file_get_contents(base_path("tests/Feature/Api/Manage{$this->plural_model_name}Test.php"))); + $this->assertEquals($featureTestClassContent, file_get_contents(base_path("tests/Feature/Api/Manage{$this->model_name}Test.php"))); } } diff --git a/tests/Generators/FeatureTestGeneratorTest.php b/tests/Generators/FeatureTestGeneratorTest.php index 8eeb0ba..f2fc59d 100644 --- a/tests/Generators/FeatureTestGeneratorTest.php +++ b/tests/Generators/FeatureTestGeneratorTest.php @@ -53,7 +53,7 @@ abstract class BrowserKitTest extends BaseTestCase { $this->artisan('make:crud', ['name' => $this->model_name, '--no-interaction' => true]); - $this->assertFileExists(base_path("tests/Feature/Manage{$this->plural_model_name}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Manage{$this->model_name}Test.php")); $modelClassContent = "full_model_name}; use Tests\BrowserKitTest as TestCase; use Illuminate\Foundation\Testing\DatabaseMigrations; -class Manage{$this->plural_model_name}Test extends TestCase +class Manage{$this->model_name}Test extends TestCase { use DatabaseMigrations; @@ -191,7 +191,7 @@ class Manage{$this->plural_model_name}Test extends TestCase } } "; - $this->assertEquals($modelClassContent, file_get_contents(base_path("tests/Feature/Manage{$this->plural_model_name}Test.php"))); + $this->assertEquals($modelClassContent, file_get_contents(base_path("tests/Feature/Manage{$this->model_name}Test.php"))); } /** @test */ @@ -250,7 +250,7 @@ abstract class {$baseTestClass} extends BaseTestCase $this->artisan('make:crud', ['name' => $this->model_name, '--no-interaction' => true]); - $this->assertFileExists(base_path("tests/Feature/Manage{$this->plural_model_name}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Manage{$this->model_name}Test.php")); $modelClassContent = "full_model_name}; use Tests\TestCase as TestCase; use Illuminate\Foundation\Testing\DatabaseMigrations; -class Manage{$this->plural_model_name}Test extends TestCase +class Manage{$this->model_name}Test extends TestCase { use DatabaseMigrations; @@ -388,6 +388,6 @@ class Manage{$this->plural_model_name}Test extends TestCase } } "; - $this->assertEquals($modelClassContent, file_get_contents(base_path("tests/Feature/Manage{$this->plural_model_name}Test.php"))); + $this->assertEquals($modelClassContent, file_get_contents(base_path("tests/Feature/Manage{$this->model_name}Test.php"))); } } diff --git a/tests/Generators/Simple/FeatureTestGeneratorTest.php b/tests/Generators/Simple/FeatureTestGeneratorTest.php index a17faee..d816aa0 100644 --- a/tests/Generators/Simple/FeatureTestGeneratorTest.php +++ b/tests/Generators/Simple/FeatureTestGeneratorTest.php @@ -53,7 +53,7 @@ abstract class BrowserKitTest extends BaseTestCase { $this->artisan('make:crud-simple', ['name' => $this->model_name, '--no-interaction' => true]); - $this->assertFileExists(base_path("tests/Feature/Manage{$this->plural_model_name}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Manage{$this->model_name}Test.php")); $modelClassContent = "full_model_name}; use Tests\BrowserKitTest as TestCase; use Illuminate\Foundation\Testing\DatabaseMigrations; -class Manage{$this->plural_model_name}Test extends TestCase +class Manage{$this->model_name}Test extends TestCase { use DatabaseMigrations; @@ -144,7 +144,7 @@ class Manage{$this->plural_model_name}Test extends TestCase } } "; - $this->assertEquals($modelClassContent, file_get_contents(base_path("tests/Feature/Manage{$this->plural_model_name}Test.php"))); + $this->assertEquals($modelClassContent, file_get_contents(base_path("tests/Feature/Manage{$this->model_name}Test.php"))); } /** @test */ @@ -203,7 +203,7 @@ abstract class {$baseTestClass} extends BaseTestCase $this->artisan('make:crud-simple', ['name' => $this->model_name, '--no-interaction' => true]); - $this->assertFileExists(base_path("tests/Feature/Manage{$this->plural_model_name}Test.php")); + $this->assertFileExists(base_path("tests/Feature/Manage{$this->model_name}Test.php")); $modelClassContent = "full_model_name}; use Tests\TestCase as TestCase; use Illuminate\Foundation\Testing\DatabaseMigrations; -class Manage{$this->plural_model_name}Test extends TestCase +class Manage{$this->model_name}Test extends TestCase { use DatabaseMigrations; @@ -294,6 +294,6 @@ class Manage{$this->plural_model_name}Test extends TestCase } } "; - $this->assertEquals($modelClassContent, file_get_contents(base_path("tests/Feature/Manage{$this->plural_model_name}Test.php"))); + $this->assertEquals($modelClassContent, file_get_contents(base_path("tests/Feature/Manage{$this->model_name}Test.php"))); } }