Browse Source

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
tags/1.1.1
Nafies Luthfi 8 years ago
parent
commit
79225ff7e4
  1. 2
      src/stubs/test-unit.stub
  2. 4
      tests/Generators/ModelTestGeneratorTest.php

2
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')]

4
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}')]

Loading…
Cancel
Save