$summit_id, 'page' => 1, 'per_page' => 10, 'order' => '+id', 'expand' => 'owner,order,ticket_type,badge,promo_code' ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "GET", "OAuth2SummitTicketApiController@getAllBySummit", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(200); $tickets = json_decode($content); $this->assertTrue(!is_null($tickets)); return $tickets; } /** * @param int $summit_id * @return mixed */ public function testGetAllTicketsCSV($summit_id = 4){ $params = [ 'summit_id' => $summit_id, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "GET", "OAuth2SummitTicketApiController@getAllBySummitCSV", $params, [], [], [], $headers ); $csv = $response->getContent(); $this->assertResponseStatus(200); $this->assertTrue(!empty($csv)); return $csv; } public function testGetTicketImportTemplate($summit_id = 3){ $params = [ 'summit_id' => $summit_id, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "GET", "OAuth2SummitTicketApiController@getImportTicketDataTemplate", $params, [], [], [], $headers ); $csv = $response->getContent(); $this->assertResponseStatus(200); $this->assertTrue(!empty($csv)); return $csv; } public function testIngestTicketData($summit_id = 21){ $csv_content = << $summit_id, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, ]; $response = $this->action( "POST", "OAuth2SummitTicketApiController@importTicketData", $params, [], [], [ 'file' => $file ], $headers ); $content = $response->getContent(); $this->assertResponseStatus(200); } public function testIngestTicketData2($summit_id = 1){ $csv_content = << $summit_id, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, ]; $response = $this->action( "POST", "OAuth2SummitTicketApiController@importTicketData", $params, [], [], [ 'file' => $file ], $headers ); $content = $response->getContent(); $this->assertResponseStatus(200); } /** * @param int $summit_id * @param string $number * @return mixed */ public function testGetTicketByNumber($summit_id = 27, $number = 'SHANGHAI2019_TICKET_5D658DE87978A699249976'){ $params = [ 'summit_id' => $summit_id, 'ticket_id' => $number, 'expand' => 'order' ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "GET", "OAuth2SummitTicketApiController@get", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(200); $ticket = json_decode($content); $this->assertTrue(!is_null($ticket)); return $ticket; } // badges endpoints /** * @param int $summit_id * @param string $number * @return mixed */ public function testCreateAttendeeBadge($summit_id = 27, $number = 'SHANGHAI2019_TICKET_5D658F4EF058F555164878'){ $params = [ 'id' => $summit_id, 'ticket_id' => $number ]; $data = [ 'badge_type_id' => 2, 'features' => [1, 2] ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "POST", "OAuth2SummitTicketApiController@createAttendeeBadge", $params, [], [], [], $headers, json_encode($data) ); $content = $response->getContent(); $this->assertResponseStatus(201); $badge = json_decode($content); $this->assertTrue(!is_null($badge)); return $badge; } public function testRemoveAttendeeBadgeFeature($summit_id = 27, $number = 'SHANGHAI2019_TICKET_5D658F4EF058F555164878', $feature_id = 1){ $params = [ 'id' => $summit_id, 'ticket_id' => $number, 'feature_id' => $feature_id, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "DELETE", "OAuth2SummitTicketApiController@removeAttendeeBadgeFeature", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(201); $badge = json_decode($content); $this->assertTrue(!is_null($badge)); return $badge; } public function testAddAttendeeBadgeFeature($summit_id = 27, $number = 'SHANGHAI2019_TICKET_5D658F4EF058F555164878', $feature_id = 1){ $params = [ 'id' => $summit_id, 'ticket_id' => $number, 'feature_id' => $feature_id, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "PUT", "OAuth2SummitTicketApiController@addAttendeeBadgeFeature", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(201); $badge = json_decode($content); $this->assertTrue(!is_null($badge)); return $badge; } /** * @param int $summit_id * @param string $number * @param int $type * @return mixed */ function testUpdateAttendeeBadgeType($summit_id = 27, $number = 'SHANGHAI2019_TICKET_5D658F4EF058F555164878', $type = 1){ $params = [ 'id' => $summit_id, 'ticket_id' => $number, 'type_id' => $type, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "PUT", "OAuth2SummitTicketApiController@updateAttendeeBadgeType", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(201); $badge = json_decode($content); $this->assertTrue(!is_null($badge)); return $badge; } /** * @param int $summit_id * @param string $number * @return mixed */ public function testDeleteAttendeeBadge($summit_id = 27, $number = 'SHANGHAI2019_TICKET_5D658F4EF058F555164878'){ $params = [ 'id' => $summit_id, 'ticket_id' => $number ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "DELETE", "OAuth2SummitTicketApiController@deleteAttendeeBadge", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(204); } /** * @param int $summit_id * @param string $number * @return mixed */ function testPrintAttendeeBadge($summit_id = 1, $number = 'REGISTRATIONDEVSUMMIT2019_TICKET_5D7BE0E518E8C161661586'){ $params = [ 'id' => $summit_id, 'ticket_id' => $number, 'expand' => 'features', ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "PUT", "OAuth2SummitTicketApiController@printAttendeeBadge", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(201); $badge = json_decode($content); $this->assertTrue(!is_null($badge)); return $badge; } }