WebTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace Tests\Routes;
  3. use App\User;
  4. use Illuminate\Support\Str;
  5. use Tests\TestCase;
  6. class WebTest extends TestCase
  7. {
  8. const PARAM = 1;
  9. const GET = [
  10. "/home",
  11. "/homeTemp",
  12. "password/change",
  13. "password/update",
  14. ];
  15. const POST = [
  16. ];
  17. const PUT = [
  18. ];
  19. const DELETE = [
  20. ];
  21. const RESTFUL = [
  22. ];
  23. public function testGet(){
  24. $superAdmin = config('users.superAdmin');
  25. $user = User::query()->where('name',$superAdmin[0])->first();
  26. if (!$user){
  27. $user = User::query()->create([
  28. 'name' => $superAdmin[0],
  29. 'email' => "test@example.com",
  30. 'password' => "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
  31. 'remember_token' => Str::random(10),
  32. ]);
  33. }
  34. $urls = array_merge(self::GET,self::RESTFUL);
  35. /** @var User $user */
  36. foreach ($urls as $url){
  37. $response = $this->actingAs($user)->get($url);
  38. $this->assertNotEquals($response->getStatusCode(),404);
  39. }
  40. }
  41. public function testPost(){
  42. }
  43. }