23, 'page' => 1, 'per_page' => 10, 'order' => '+id', 'filter' => 'email=@jimmy', 'expand' => 'member,schedule,rsvp' ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "GET", "OAuth2SummitAttendeesApiController@getAttendeesBySummit", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(200); $attendees = json_decode($content); $this->assertTrue(!is_null($attendees)); } public function testGetOwnAttendee(){ $params = [ 'id' => 23, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "GET", "OAuth2SummitAttendeesApiController@getOwnAttendee", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(200); $attendee = json_decode($content); $this->assertTrue(!is_null($attendee)); } public function testGetAttendeeByID($attendee_id = 12923){ $params = [ 'id' => 23, 'attendee_id' => $attendee_id, 'expand' => 'member,schedule,tickets,groups,rsvp,all_affiliations' ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "GET", "OAuth2SummitAttendeesApiController@getAttendee", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(200); $attendee = json_decode($content); $this->assertTrue(!is_null($attendee)); return $attendee; } public function testGetAttendeeByOrderID(){ $params = [ 'id' => 23, 'page' => 1, 'per_page' => 10, 'order' => '+external_order_id', 'filter' => 'external_order_id==615528547', 'expand' => 'member,schedule,tickets,ticket_type,all_affiliations' ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "GET", "OAuth2SummitAttendeesApiController@getAttendeesBySummit", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(200); $attendees = json_decode($content); $this->assertTrue(!is_null($attendees)); } public function testAddAttendee($member_id = 1){ $params = [ 'id' => 23, ]; $data = [ 'member_id' => $member_id ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "POST", "OAuth2SummitAttendeesApiController@addAttendee", $params, [], [], [], $headers, json_encode($data) ); $content = $response->getContent(); $this->assertResponseStatus(201); $attendee = json_decode($content); $this->assertTrue(!is_null($attendee)); return $attendee; } public function testDeleteAttendee(){ $attendee = $this->testAddAttendee(3); $params = [ 'id' => 23, 'attendee_id' => $attendee->id ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "DELETE", "OAuth2SummitAttendeesApiController@deleteAttendee", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(204); } public function testUpdateAttendee(){ $attendee = $this->testGetAttendeeByID(12642); $params = [ 'id' => 23, 'attendee_id' => $attendee->id ]; $data = [ 'member_id' => $attendee->member->id, 'share_contact_info' => true ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "PUT", "OAuth2SummitAttendeesApiController@updateAttendee", $params, [], [], [], $headers, json_encode($data) ); $content = $response->getContent(); $this->assertResponseStatus(204); $attendee = json_decode($content); $this->assertTrue(!is_null($attendee)); return $attendee; } public function testAddAttendeeTicket(){ $params = [ 'id' => 23, 'attendee_id' => 12642 ]; $data = [ 'ticket_type_id' => 50, 'external_order_id' => '617372932', 'external_attendee_id' => '774078887', ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "POST", "OAuth2SummitAttendeesApiController@addAttendeeTicket", $params, [], [], [], $headers, json_encode($data) ); $content = $response->getContent(); $this->assertResponseStatus(201); $ticket = json_decode($content); $this->assertTrue(!is_null($ticket)); return $ticket; } public function testDeleteAttendeeTicket(){ $params = [ 'id' => 23, 'attendee_id' => 12642, 'ticket_id' => 14161 ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "DELETE", "OAuth2SummitAttendeesApiController@deleteAttendeeTicket", $params, [], [], [], $headers ); $this->assertResponseStatus(204); } public function testReassignAttendeeTicket($summit_id = 25){ $params = [ 'id' => $summit_id, 'attendee_id' => 14938, 'ticket_id' => 15070, 'other_member_id' => 13867, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "PUT", "OAuth2SummitAttendeesApiController@reassignAttendeeTicket", $params, [], [], [], $headers, '' ); $content = $response->getContent(); $this->assertResponseStatus(201); $ticket = json_decode($content); $this->assertTrue(!is_null($ticket)); return $ticket; } }