| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace Tests\Routes;
- use App\User;
- use Illuminate\Support\Str;
- use Tests\TestCase;
- class WebTest extends TestCase
- {
- const PARAM = 1;
- const GET = [
- "/home",
- "/homeTemp",
- "password/change",
- "password/update",
- ];
- const POST = [
- ];
- const PUT = [
- ];
- const DELETE = [
- ];
- const RESTFUL = [
- ];
- const ANY = [
- ];
- const MATCH = [
- ];
- 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 $method => $route){
- 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);
- }
- }
- $urls = array_merge(self::GET,self::RESTFUL);
- /** @var User $user */
- foreach ($urls as $url){
- $response = $this->actingAs($user)->get($url);
- $this->assertNotEquals($response->getStatusCode(),404);
- }
- }
- public function testPost(){
- }
- }
|