From 79225ff7e4f8e1e63068942aeb2148701ab8ceda Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sat, 31 Mar 2018 07:59:15 +0800 Subject: [PATCH] Remove id attribute call on model unit test Laravel will automatically recognize the route key name attribute for the model, so we dont need to specify the id attribute on the named route call --- src/stubs/test-unit.stub | 2 +- tests/Generators/ModelTestGeneratorTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/stubs/test-unit.stub b/src/stubs/test-unit.stub index 10b632d..6f4ab8b 100644 --- a/src/stubs/test-unit.stub +++ b/src/stubs/test-unit.stub @@ -17,7 +17,7 @@ class MasterTest extends TestCase $singleMstr = factory(Master::class)->create(); $this->assertEquals( - link_to_route('masters.show', $singleMstr->name, [$singleMstr->id], [ + link_to_route('masters.show', $singleMstr->name, [$singleMstr], [ 'title' => trans( 'app.show_detail_title', ['name' => $singleMstr->name, 'type' => trans('master.master')] diff --git a/tests/Generators/ModelTestGeneratorTest.php b/tests/Generators/ModelTestGeneratorTest.php index ca7ae87..ecd3591 100644 --- a/tests/Generators/ModelTestGeneratorTest.php +++ b/tests/Generators/ModelTestGeneratorTest.php @@ -32,7 +32,7 @@ class {$this->model_name}Test extends TestCase \${$this->single_model_var_name} = factory({$this->model_name}::class)->create(); \$this->assertEquals( - link_to_route('{$this->table_name}.show', \${$this->single_model_var_name}->name, [\${$this->single_model_var_name}->id], [ + link_to_route('{$this->table_name}.show', \${$this->single_model_var_name}->name, [\${$this->single_model_var_name}], [ 'title' => trans( 'app.show_detail_title', ['name' => \${$this->single_model_var_name}->name, 'type' => trans('{$this->lang_name}.{$this->lang_name}')] @@ -83,7 +83,7 @@ class {$this->model_name}Test extends TestCase \${$this->single_model_var_name} = factory({$this->model_name}::class)->create(); \$this->assertEquals( - link_to_route('{$this->table_name}.show', \${$this->single_model_var_name}->name, [\${$this->single_model_var_name}->id], [ + link_to_route('{$this->table_name}.show', \${$this->single_model_var_name}->name, [\${$this->single_model_var_name}], [ 'title' => trans( 'app.show_detail_title', ['name' => \${$this->single_model_var_name}->name, 'type' => trans('{$this->lang_name}.{$this->lang_name}')]