Browse Source

Update feature test stub to use submitForm method

tags/1.0.2
Nafies Luthfi 8 years ago
parent
commit
b00af7f027
  1. 14
      src/stubs/test-feature-simple.stub
  2. 28
      tests/Generators/Simple/FeatureTestGeneratorTest.php

14
src/stubs/test-feature-simple.stub

@ -31,9 +31,10 @@ class ManageMastersTest extends TestCase
$this->click(trans('master.create'));
$this->seePageIs(route('masters.index', ['action' => 'create']));
$this->type('Master 1 name', 'name');
$this->type('Master 1 description', 'description');
$this->press(trans('master.create'));
$this->submitForm(trans('master.create'), [
'name' => 'Master 1 name',
'description' => 'Master 1 description',
]);
$this->seePageIs(route('masters.index'));
@ -53,9 +54,10 @@ class ManageMastersTest extends TestCase
$this->click('edit-master-'.$singleMstr->id);
$this->seePageIs(route('masters.index', ['action' => 'edit', 'id' => $singleMstr->id, 'q' => '123']));
$this->type('Master 1 name', 'name');
$this->type('Master 1 description', 'description');
$this->press(trans('master.update'));
$this->submitForm(trans('master.update'), [
'name' => 'Master 1 name',
'description' => 'Master 1 description',
]);
$this->seePageIs(route('masters.index', ['q' => '123']));

28
tests/Generators/Simple/FeatureTestGeneratorTest.php

@ -82,9 +82,10 @@ class Manage{$this->plural_model_name}Test extends TestCase
\$this->click(trans('{$this->lang_name}.create'));
\$this->seePageIs(route('{$this->table_name}.index', ['action' => 'create']));
\$this->type('{$this->model_name} 1 name', 'name');
\$this->type('{$this->model_name} 1 description', 'description');
\$this->press(trans('{$this->lang_name}.create'));
\$this->submitForm(trans('{$this->lang_name}.create'), [
'name' => '{$this->model_name} 1 name',
'description' => '{$this->model_name} 1 description',
]);
\$this->seePageIs(route('{$this->table_name}.index'));
@ -104,9 +105,10 @@ class Manage{$this->plural_model_name}Test extends TestCase
\$this->click('edit-{$this->lang_name}-'.\${$this->single_model_var_name}->id);
\$this->seePageIs(route('{$this->table_name}.index', ['action' => 'edit', 'id' => \${$this->single_model_var_name}->id, 'q' => '123']));
\$this->type('{$this->model_name} 1 name', 'name');
\$this->type('{$this->model_name} 1 description', 'description');
\$this->press(trans('{$this->lang_name}.update'));
\$this->submitForm(trans('{$this->lang_name}.update'), [
'name' => '{$this->model_name} 1 name',
'description' => '{$this->model_name} 1 description',
]);
\$this->seePageIs(route('{$this->table_name}.index', ['q' => '123']));
@ -226,9 +228,10 @@ class Manage{$this->plural_model_name}Test extends TestCase
\$this->click(trans('{$this->lang_name}.create'));
\$this->seePageIs(route('{$this->table_name}.index', ['action' => 'create']));
\$this->type('{$this->model_name} 1 name', 'name');
\$this->type('{$this->model_name} 1 description', 'description');
\$this->press(trans('{$this->lang_name}.create'));
\$this->submitForm(trans('{$this->lang_name}.create'), [
'name' => '{$this->model_name} 1 name',
'description' => '{$this->model_name} 1 description',
]);
\$this->seePageIs(route('{$this->table_name}.index'));
@ -248,9 +251,10 @@ class Manage{$this->plural_model_name}Test extends TestCase
\$this->click('edit-{$this->lang_name}-'.\${$this->single_model_var_name}->id);
\$this->seePageIs(route('{$this->table_name}.index', ['action' => 'edit', 'id' => \${$this->single_model_var_name}->id, 'q' => '123']));
\$this->type('{$this->model_name} 1 name', 'name');
\$this->type('{$this->model_name} 1 description', 'description');
\$this->press(trans('{$this->lang_name}.update'));
\$this->submitForm(trans('{$this->lang_name}.update'), [
'name' => '{$this->model_name} 1 name',
'description' => '{$this->model_name} 1 description',
]);
\$this->seePageIs(route('{$this->table_name}.index', ['q' => '123']));

Loading…
Cancel
Save