|
|
|
@ -16,7 +16,7 @@ class FeatureTestGeneratorTest extends TestCase |
|
|
|
|
|
|
|
namespace Tests; |
|
|
|
|
|
|
|
use App\User; |
|
|
|
use App\Models\User; |
|
|
|
use Laravel\BrowserKitTesting\TestCase as BaseTestCase; |
|
|
|
|
|
|
|
abstract class BrowserKitTest extends BaseTestCase |
|
|
|
@ -35,7 +35,7 @@ abstract class BrowserKitTest extends BaseTestCase |
|
|
|
|
|
|
|
protected function createUser() |
|
|
|
{ |
|
|
|
return factory(User::class)->create(); |
|
|
|
return User::factory()->create(); |
|
|
|
} |
|
|
|
} |
|
|
|
";
|
|
|
|
@ -63,7 +63,7 @@ class Manage{$this->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} = factory({$this->model_name}::class)->create(); |
|
|
|
\${$this->single_model_var_name} = {$this->model_name}::factory()->create(); |
|
|
|
|
|
|
|
\$this->loginAsUser(); |
|
|
|
\$this->visitRoute('{$this->table_name}.index'); |
|
|
|
@ -140,7 +140,7 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
public function user_can_edit_a_{$this->lang_name}() |
|
|
|
{ |
|
|
|
\$this->loginAsUser(); |
|
|
|
\${$this->single_model_var_name} = factory({$this->model_name}::class)->create(['name' => 'Testing 123']); |
|
|
|
\${$this->single_model_var_name} = {$this->model_name}::factory()->create(['name' => 'Testing 123']); |
|
|
|
|
|
|
|
\$this->visitRoute('{$this->table_name}.show', \${$this->single_model_var_name}); |
|
|
|
\$this->click('edit-{$this->lang_name}-'.\${$this->single_model_var_name}->id); |
|
|
|
@ -159,7 +159,7 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
public function validate_{$this->lang_name}_name_update_is_required() |
|
|
|
{ |
|
|
|
\$this->loginAsUser(); |
|
|
|
\${$this->lang_name} = factory({$this->model_name}::class)->create(['name' => 'Testing 123']); |
|
|
|
\${$this->lang_name} = {$this->model_name}::factory()->create(['name' => 'Testing 123']); |
|
|
|
|
|
|
|
// name empty
|
|
|
|
\$this->patch(route('{$this->table_name}.update', \${$this->lang_name}), \$this->getEditFields(['name' => ''])); |
|
|
|
@ -170,7 +170,7 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
public function validate_{$this->lang_name}_name_update_is_not_more_than_60_characters() |
|
|
|
{ |
|
|
|
\$this->loginAsUser(); |
|
|
|
\${$this->lang_name} = factory({$this->model_name}::class)->create(['name' => 'Testing 123']); |
|
|
|
\${$this->lang_name} = {$this->model_name}::factory()->create(['name' => 'Testing 123']); |
|
|
|
|
|
|
|
// name 70 characters
|
|
|
|
\$this->patch(route('{$this->table_name}.update', \${$this->lang_name}), \$this->getEditFields([ |
|
|
|
@ -183,7 +183,7 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
public function validate_{$this->lang_name}_description_update_is_not_more_than_255_characters() |
|
|
|
{ |
|
|
|
\$this->loginAsUser(); |
|
|
|
\${$this->lang_name} = factory({$this->model_name}::class)->create(['name' => 'Testing 123']); |
|
|
|
\${$this->lang_name} = {$this->model_name}::factory()->create(['name' => 'Testing 123']); |
|
|
|
|
|
|
|
// description 256 characters
|
|
|
|
\$this->patch(route('{$this->table_name}.update', \${$this->lang_name}), \$this->getEditFields([ |
|
|
|
@ -196,8 +196,8 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
public function user_can_delete_a_{$this->lang_name}() |
|
|
|
{ |
|
|
|
\$this->loginAsUser(); |
|
|
|
\${$this->single_model_var_name} = factory({$this->model_name}::class)->create(); |
|
|
|
factory({$this->model_name}::class)->create(); |
|
|
|
\${$this->single_model_var_name} = {$this->model_name}::factory()->create(); |
|
|
|
{$this->model_name}::factory()->create(); |
|
|
|
|
|
|
|
\$this->visitRoute('{$this->table_name}.edit', \${$this->single_model_var_name}); |
|
|
|
\$this->click('del-{$this->lang_name}-'.\${$this->single_model_var_name}->id); |
|
|
|
@ -230,7 +230,7 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
|
|
|
|
namespace Tests; |
|
|
|
|
|
|
|
use App\User; |
|
|
|
use App\Models\User; |
|
|
|
use Laravel\BrowserKitTesting\TestCase as BaseTestCase; |
|
|
|
|
|
|
|
abstract class {$baseTestClass} extends BaseTestCase |
|
|
|
@ -249,7 +249,7 @@ abstract class {$baseTestClass} extends BaseTestCase |
|
|
|
|
|
|
|
protected function createUser() |
|
|
|
{ |
|
|
|
return factory(User::class)->create(); |
|
|
|
return User::factory()->create(); |
|
|
|
} |
|
|
|
} |
|
|
|
";
|
|
|
|
@ -280,7 +280,7 @@ class Manage{$this->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} = factory({$this->model_name}::class)->create(); |
|
|
|
\${$this->single_model_var_name} = {$this->model_name}::factory()->create(); |
|
|
|
|
|
|
|
\$this->loginAsUser(); |
|
|
|
\$this->visitRoute('{$this->table_name}.index'); |
|
|
|
@ -357,7 +357,7 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
public function user_can_edit_a_{$this->lang_name}() |
|
|
|
{ |
|
|
|
\$this->loginAsUser(); |
|
|
|
\${$this->single_model_var_name} = factory({$this->model_name}::class)->create(['name' => 'Testing 123']); |
|
|
|
\${$this->single_model_var_name} = {$this->model_name}::factory()->create(['name' => 'Testing 123']); |
|
|
|
|
|
|
|
\$this->visitRoute('{$this->table_name}.show', \${$this->single_model_var_name}); |
|
|
|
\$this->click('edit-{$this->lang_name}-'.\${$this->single_model_var_name}->id); |
|
|
|
@ -376,7 +376,7 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
public function validate_{$this->lang_name}_name_update_is_required() |
|
|
|
{ |
|
|
|
\$this->loginAsUser(); |
|
|
|
\${$this->lang_name} = factory({$this->model_name}::class)->create(['name' => 'Testing 123']); |
|
|
|
\${$this->lang_name} = {$this->model_name}::factory()->create(['name' => 'Testing 123']); |
|
|
|
|
|
|
|
// name empty
|
|
|
|
\$this->patch(route('{$this->table_name}.update', \${$this->lang_name}), \$this->getEditFields(['name' => ''])); |
|
|
|
@ -387,7 +387,7 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
public function validate_{$this->lang_name}_name_update_is_not_more_than_60_characters() |
|
|
|
{ |
|
|
|
\$this->loginAsUser(); |
|
|
|
\${$this->lang_name} = factory({$this->model_name}::class)->create(['name' => 'Testing 123']); |
|
|
|
\${$this->lang_name} = {$this->model_name}::factory()->create(['name' => 'Testing 123']); |
|
|
|
|
|
|
|
// name 70 characters
|
|
|
|
\$this->patch(route('{$this->table_name}.update', \${$this->lang_name}), \$this->getEditFields([ |
|
|
|
@ -400,7 +400,7 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
public function validate_{$this->lang_name}_description_update_is_not_more_than_255_characters() |
|
|
|
{ |
|
|
|
\$this->loginAsUser(); |
|
|
|
\${$this->lang_name} = factory({$this->model_name}::class)->create(['name' => 'Testing 123']); |
|
|
|
\${$this->lang_name} = {$this->model_name}::factory()->create(['name' => 'Testing 123']); |
|
|
|
|
|
|
|
// description 256 characters
|
|
|
|
\$this->patch(route('{$this->table_name}.update', \${$this->lang_name}), \$this->getEditFields([ |
|
|
|
@ -413,8 +413,8 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
public function user_can_delete_a_{$this->lang_name}() |
|
|
|
{ |
|
|
|
\$this->loginAsUser(); |
|
|
|
\${$this->single_model_var_name} = factory({$this->model_name}::class)->create(); |
|
|
|
factory({$this->model_name}::class)->create(); |
|
|
|
\${$this->single_model_var_name} = {$this->model_name}::factory()->create(); |
|
|
|
{$this->model_name}::factory()->create(); |
|
|
|
|
|
|
|
\$this->visitRoute('{$this->table_name}.edit', \${$this->single_model_var_name}); |
|
|
|
\$this->click('del-{$this->lang_name}-'.\${$this->single_model_var_name}->id); |
|
|
|
@ -455,7 +455,7 @@ class Manage{$this->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} = factory({$this->model_name}::class)->create(); |
|
|
|
\${$this->single_model_var_name} = {$this->model_name}::factory()->create(); |
|
|
|
|
|
|
|
\$this->loginAsUser(); |
|
|
|
\$this->visitRoute('{$this->table_name}.index'); |
|
|
|
@ -532,7 +532,7 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
public function user_can_edit_a_{$this->lang_name}() |
|
|
|
{ |
|
|
|
\$this->loginAsUser(); |
|
|
|
\${$this->single_model_var_name} = factory({$this->model_name}::class)->create(['name' => 'Testing 123']); |
|
|
|
\${$this->single_model_var_name} = {$this->model_name}::factory()->create(['name' => 'Testing 123']); |
|
|
|
|
|
|
|
\$this->visitRoute('{$this->table_name}.show', \${$this->single_model_var_name}); |
|
|
|
\$this->click('edit-{$this->lang_name}-'.\${$this->single_model_var_name}->id); |
|
|
|
@ -551,7 +551,7 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
public function validate_{$this->lang_name}_name_update_is_required() |
|
|
|
{ |
|
|
|
\$this->loginAsUser(); |
|
|
|
\${$this->lang_name} = factory({$this->model_name}::class)->create(['name' => 'Testing 123']); |
|
|
|
\${$this->lang_name} = {$this->model_name}::factory()->create(['name' => 'Testing 123']); |
|
|
|
|
|
|
|
// name empty
|
|
|
|
\$this->patch(route('{$this->table_name}.update', \${$this->lang_name}), \$this->getEditFields(['name' => ''])); |
|
|
|
@ -562,7 +562,7 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
public function validate_{$this->lang_name}_name_update_is_not_more_than_60_characters() |
|
|
|
{ |
|
|
|
\$this->loginAsUser(); |
|
|
|
\${$this->lang_name} = factory({$this->model_name}::class)->create(['name' => 'Testing 123']); |
|
|
|
\${$this->lang_name} = {$this->model_name}::factory()->create(['name' => 'Testing 123']); |
|
|
|
|
|
|
|
// name 70 characters
|
|
|
|
\$this->patch(route('{$this->table_name}.update', \${$this->lang_name}), \$this->getEditFields([ |
|
|
|
@ -575,7 +575,7 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
public function validate_{$this->lang_name}_description_update_is_not_more_than_255_characters() |
|
|
|
{ |
|
|
|
\$this->loginAsUser(); |
|
|
|
\${$this->lang_name} = factory({$this->model_name}::class)->create(['name' => 'Testing 123']); |
|
|
|
\${$this->lang_name} = {$this->model_name}::factory()->create(['name' => 'Testing 123']); |
|
|
|
|
|
|
|
// description 256 characters
|
|
|
|
\$this->patch(route('{$this->table_name}.update', \${$this->lang_name}), \$this->getEditFields([ |
|
|
|
@ -588,8 +588,8 @@ class Manage{$this->model_name}Test extends TestCase |
|
|
|
public function user_can_delete_a_{$this->lang_name}() |
|
|
|
{ |
|
|
|
\$this->loginAsUser(); |
|
|
|
\${$this->single_model_var_name} = factory({$this->model_name}::class)->create(); |
|
|
|
factory({$this->model_name}::class)->create(); |
|
|
|
\${$this->single_model_var_name} = {$this->model_name}::factory()->create(); |
|
|
|
{$this->model_name}::factory()->create(); |
|
|
|
|
|
|
|
\$this->visitRoute('{$this->table_name}.edit', \${$this->single_model_var_name}); |
|
|
|
\$this->click('del-{$this->lang_name}-'.\${$this->single_model_var_name}->id); |
|
|
|
|