['get','post'], ]; public function testRoutes(){ /* $superAdmin = config('users.superAdmin'); $user = User::query()->where('name',$superAdmin[0])->first(); if (!$user){ $user = User::query()->create([ 'name' => $superAdmin[0], 'email' => "test@example.com", 'password' => "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi", 'remember_token' => Str::random(10), ]); }*/ $getMethod = self::GET; $postMethod = self::POST; $putMethod = self::PUT; $deleteMethod = self::DELETE; foreach (self::MATCH as $route => $methods){ foreach ($methods as $method){ if ($method == 'get'){ array_push($getMethod,$route); } if ($method == 'post'){ array_push($postMethod,$route); } if ($method == 'put'){ array_push($putMethod,$route); } if ($method == 'delete'){ array_push($deleteMethod,$route); } } } foreach (self::ANY as $route){ array_push($getMethod,$route); array_push($postMethod,$route); array_push($putMethod,$route); array_push($deleteMethod,$route); } foreach (self::RESTFUL as $route){ array_push($getMethod,$route); array_push($getMethod,$route.'/'.self::PARAM); array_push($getMethod,$route.'/create'); array_push($postMethod,$route); array_push($getMethod,$route.'/'.self::PARAM.'/edit'); array_push($putMethod,$route.'/'.self::PARAM); array_push($deleteMethod,$route.'/'.self::PARAM); } /** @var User $user */ foreach ($getMethod as $url){ $response = $this/*->actingAs($user)*/->get($url); if ($response->getStatusCode() == 404)echo $url."\n"; $this->assertNotEquals($response->getStatusCode(),404); } /** @var User $user */ foreach ($postMethod as $url){ $response = $this/*->actingAs($user)*/->post($url); if ($response->getStatusCode() == 404)echo $url."\n"; $this->assertNotEquals($response->getStatusCode(),404); } /** @var User $user */ foreach ($putMethod as $url){ $response = $this/*->actingAs($user)*/->put($url); if ($response->getStatusCode() == 404)echo $url."\n"; $this->assertNotEquals($response->getStatusCode(),404); } /** @var User $user */ foreach ($deleteMethod as $url){ $response = $this/*->actingAs($user)*/->delete($url); if ($response->getStatusCode() == 404)echo $url."\n"; $this->assertNotEquals($response->getStatusCode(),404); } } }