CountryFeatureTest.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace Tests\Feature\Admin\Countries;
  3. use App\Shop\Countries\Country;
  4. use Tests\TestCase;
  5. class CountryFeatureTest extends TestCase
  6. {
  7. /** @test */
  8. public function it_can_update_the_country()
  9. {
  10. $data = ['name' => $this->faker->name];
  11. $country = factory(Country::class)->create();
  12. $this
  13. ->actingAs($this->employee, 'employee')
  14. ->put(route('admin.countries.update', $country->id), $data)
  15. ->assertStatus(302)
  16. ->assertRedirect(route('admin.countries.edit', $country->id))
  17. ->assertSessionHas('message', 'Update successful');
  18. }
  19. /** @test */
  20. public function it_can_show_the_country()
  21. {
  22. $country = factory(Country::class)->create();
  23. $this
  24. ->actingAs($this->employee, 'employee')
  25. ->get(route('admin.countries.show', $country->id))
  26. ->assertStatus(200)
  27. ->assertSee(htmlentities($country->name, ENT_QUOTES));
  28. }
  29. /** @test */
  30. public function it_can_list_all_the_countries()
  31. {
  32. $country = factory(Country::class)->create();
  33. $this
  34. ->actingAs($this->employee, 'employee')
  35. ->get(route('admin.countries.index'))
  36. ->assertStatus(200)
  37. ->assertSee(htmlentities($country->name, ENT_QUOTES));
  38. }
  39. /** @test */
  40. public function it_can_show_the_edit_country()
  41. {
  42. $country = factory(Country::class)->create();
  43. $this
  44. ->actingAs($this->employee, 'employee')
  45. ->get(route('admin.countries.edit', $country->id))
  46. ->assertStatus(200)
  47. ->assertSee(htmlentities($country->name, ENT_QUOTES));
  48. }
  49. }