From daa04653650c5dafb03fdf500934a9b7aa039cb3 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Mon, 13 Aug 2018 21:27:00 +0800 Subject: [PATCH] Update feature test delete section This commit ensure the deleted record is the correct --- src/stubs/testcases/feature/full.stub | 1 + src/stubs/testcases/feature/simple.stub | 1 + tests/Generators/FeatureTestGeneratorTest.php | 2 ++ tests/Generators/Simple/FeatureTestGeneratorTest.php | 2 ++ 4 files changed, 6 insertions(+) diff --git a/src/stubs/testcases/feature/full.stub b/src/stubs/testcases/feature/full.stub index 194e3a5..395c5b9 100644 --- a/src/stubs/testcases/feature/full.stub +++ b/src/stubs/testcases/feature/full.stub @@ -121,6 +121,7 @@ class ManageMastersTest extends TestCase { $this->loginAsUser(); $singleMstr = factory(Master::class)->create(); + factory(Master::class)->create(); $this->visitRoute('masters.edit', $singleMstr); $this->click('del-master-'.$singleMstr->id); diff --git a/src/stubs/testcases/feature/simple.stub b/src/stubs/testcases/feature/simple.stub index b490b12..0e5ea37 100644 --- a/src/stubs/testcases/feature/simple.stub +++ b/src/stubs/testcases/feature/simple.stub @@ -70,6 +70,7 @@ class ManageMastersTest extends TestCase { $this->loginAsUser(); $singleMstr = factory(Master::class)->create(); + factory(Master::class)->create(); $this->visitRoute('masters.index', ['action' => 'edit', 'id' => $singleMstr->id]); $this->click('del-master-'.$singleMstr->id); diff --git a/tests/Generators/FeatureTestGeneratorTest.php b/tests/Generators/FeatureTestGeneratorTest.php index 3f9ebeb..8eeb0ba 100644 --- a/tests/Generators/FeatureTestGeneratorTest.php +++ b/tests/Generators/FeatureTestGeneratorTest.php @@ -177,6 +177,7 @@ class Manage{$this->plural_model_name}Test extends TestCase { \$this->loginAsUser(); \${$this->single_model_var_name} = factory({$this->model_name}::class)->create(); + factory({$this->model_name}::class)->create(); \$this->visitRoute('{$this->table_name}.edit', \${$this->single_model_var_name}); \$this->click('del-{$this->lang_name}-'.\${$this->single_model_var_name}->id); @@ -373,6 +374,7 @@ class Manage{$this->plural_model_name}Test extends TestCase { \$this->loginAsUser(); \${$this->single_model_var_name} = factory({$this->model_name}::class)->create(); + factory({$this->model_name}::class)->create(); \$this->visitRoute('{$this->table_name}.edit', \${$this->single_model_var_name}); \$this->click('del-{$this->lang_name}-'.\${$this->single_model_var_name}->id); diff --git a/tests/Generators/Simple/FeatureTestGeneratorTest.php b/tests/Generators/Simple/FeatureTestGeneratorTest.php index 4f69c4f..a17faee 100644 --- a/tests/Generators/Simple/FeatureTestGeneratorTest.php +++ b/tests/Generators/Simple/FeatureTestGeneratorTest.php @@ -126,6 +126,7 @@ class Manage{$this->plural_model_name}Test extends TestCase { \$this->loginAsUser(); \${$this->single_model_var_name} = factory({$this->model_name}::class)->create(); + factory({$this->model_name}::class)->create(); \$this->visitRoute('{$this->table_name}.index', ['action' => 'edit', 'id' => \${$this->single_model_var_name}->id]); \$this->click('del-{$this->lang_name}-'.\${$this->single_model_var_name}->id); @@ -275,6 +276,7 @@ class Manage{$this->plural_model_name}Test extends TestCase { \$this->loginAsUser(); \${$this->single_model_var_name} = factory({$this->model_name}::class)->create(); + factory({$this->model_name}::class)->create(); \$this->visitRoute('{$this->table_name}.index', ['action' => 'edit', 'id' => \${$this->single_model_var_name}->id]); \$this->click('del-{$this->lang_name}-'.\${$this->single_model_var_name}->id);