From b6495396b409d164a320f43507182379fbaaa9bf Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Wed, 14 Mar 2018 21:01:39 +0800 Subject: [PATCH] Update test feature simple stub --- src/stubs/test-feature-simple.stub | 14 +++++------ .../Generators/Simple/FeatureTestGeneratorTest.php | 28 ++++++++++------------ 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/src/stubs/test-feature-simple.stub b/src/stubs/test-feature-simple.stub index 35eb75c..2daeb30 100644 --- a/src/stubs/test-feature-simple.stub +++ b/src/stubs/test-feature-simple.stub @@ -13,13 +13,11 @@ class ManageMastersTest extends TestCase /** @test */ public function user_can_see_master_list_in_master_index_page() { - $singleMstr1 = factory(Master::class)->create(['name' => 'Testing name', 'description' => 'Testing 123']); - $singleMstr2 = factory(Master::class)->create(['name' => 'Testing name', 'description' => 'Testing 456']); + $singleMstr = factory(Master::class)->create(); $this->loginAsUser(); $this->visit(route('masters.index')); - $this->see($singleMstr1->name); - $this->see($singleMstr2->name); + $this->see($singleMstr->name); } /** @test */ @@ -39,8 +37,8 @@ class ManageMastersTest extends TestCase $this->seePageIs(route('masters.index')); $this->seeInDatabase('masters', [ - 'name' => 'Master 1 name', - 'description' => 'Master 1 description', + 'name' => 'Master 1 name', + 'description' => 'Master 1 description', ]); } @@ -62,8 +60,8 @@ class ManageMastersTest extends TestCase $this->seePageIs(route('masters.index', ['q' => '123'])); $this->seeInDatabase('masters', [ - 'name' => 'Master 1 name', - 'description' => 'Master 1 description', + 'name' => 'Master 1 name', + 'description' => 'Master 1 description', ]); } diff --git a/tests/Generators/Simple/FeatureTestGeneratorTest.php b/tests/Generators/Simple/FeatureTestGeneratorTest.php index 2816484..70dfbc2 100644 --- a/tests/Generators/Simple/FeatureTestGeneratorTest.php +++ b/tests/Generators/Simple/FeatureTestGeneratorTest.php @@ -64,13 +64,11 @@ class Manage{$this->plural_model_name}Test extends TestCase /** @test */ public function user_can_see_{$this->lang_name}_list_in_{$this->lang_name}_index_page() { - \${$this->single_model_var_name}1 = factory({$this->model_name}::class)->create(['name' => 'Testing name', 'description' => 'Testing 123']); - \${$this->single_model_var_name}2 = factory({$this->model_name}::class)->create(['name' => 'Testing name', 'description' => 'Testing 456']); + \${$this->single_model_var_name} = factory({$this->model_name}::class)->create(); \$this->loginAsUser(); \$this->visit(route('{$this->table_name}.index')); - \$this->see(\${$this->single_model_var_name}1->name); - \$this->see(\${$this->single_model_var_name}2->name); + \$this->see(\${$this->single_model_var_name}->name); } /** @test */ @@ -90,8 +88,8 @@ class Manage{$this->plural_model_name}Test extends TestCase \$this->seePageIs(route('{$this->table_name}.index')); \$this->seeInDatabase('{$this->table_name}', [ - 'name' => '{$this->model_name} 1 name', - 'description' => '{$this->model_name} 1 description', + 'name' => '{$this->model_name} 1 name', + 'description' => '{$this->model_name} 1 description', ]); } @@ -113,8 +111,8 @@ class Manage{$this->plural_model_name}Test extends TestCase \$this->seePageIs(route('{$this->table_name}.index', ['q' => '123'])); \$this->seeInDatabase('{$this->table_name}', [ - 'name' => '{$this->model_name} 1 name', - 'description' => '{$this->model_name} 1 description', + 'name' => '{$this->model_name} 1 name', + 'description' => '{$this->model_name} 1 description', ]); } @@ -210,13 +208,11 @@ class Manage{$this->plural_model_name}Test extends TestCase /** @test */ public function user_can_see_{$this->lang_name}_list_in_{$this->lang_name}_index_page() { - \${$this->single_model_var_name}1 = factory({$this->model_name}::class)->create(['name' => 'Testing name', 'description' => 'Testing 123']); - \${$this->single_model_var_name}2 = factory({$this->model_name}::class)->create(['name' => 'Testing name', 'description' => 'Testing 456']); + \${$this->single_model_var_name} = factory({$this->model_name}::class)->create(); \$this->loginAsUser(); \$this->visit(route('{$this->table_name}.index')); - \$this->see(\${$this->single_model_var_name}1->name); - \$this->see(\${$this->single_model_var_name}2->name); + \$this->see(\${$this->single_model_var_name}->name); } /** @test */ @@ -236,8 +232,8 @@ class Manage{$this->plural_model_name}Test extends TestCase \$this->seePageIs(route('{$this->table_name}.index')); \$this->seeInDatabase('{$this->table_name}', [ - 'name' => '{$this->model_name} 1 name', - 'description' => '{$this->model_name} 1 description', + 'name' => '{$this->model_name} 1 name', + 'description' => '{$this->model_name} 1 description', ]); } @@ -259,8 +255,8 @@ class Manage{$this->plural_model_name}Test extends TestCase \$this->seePageIs(route('{$this->table_name}.index', ['q' => '123'])); \$this->seeInDatabase('{$this->table_name}', [ - 'name' => '{$this->model_name} 1 name', - 'description' => '{$this->model_name} 1 description', + 'name' => '{$this->model_name} 1 name', + 'description' => '{$this->model_name} 1 description', ]); }