$summit_id, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $data = [ 'title' => 'Developer!', 'first_name' => 'Sebastian', 'last_name' => 'Marcet', 'email' => 'sebastian.ge4.marcet@gmail.com' ]; $response = $this->action ( "POST", "OAuth2SummitSpeakersApiController@addSpeaker", $params, [], [], [], $headers, json_encode($data) ); $this->assertResponseStatus(201); $content = $response->getContent(); $speaker = json_decode($content); $this->assertTrue($speaker->id > 0); return $speaker; } public function testPostSpeakerRegCode($summit_id = 23) { $params = [ 'id' => $summit_id, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $data = [ 'title' => 'Developer!', 'first_name' => 'Sebastian', 'last_name' => 'Marcet', 'email' => 'sebastian.ge7.marcet@gmail.com', 'registration_code' => 'SPEAKER_00001' ]; $response = $this->action ( "POST", "OAuth2SummitSpeakersApiController@addSpeaker", $params, [], [], [], $headers, json_encode($data) ); $this->assertResponseStatus(201); $content = $response->getContent(); $speaker = json_decode($content); $this->assertTrue($speaker->id > 0); return $speaker; } public function testPostSpeakerExistent($summit_id = 23) { $params = [ 'id' => $summit_id, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $data = [ 'title' => 'Developer!', 'first_name' => 'Sebastian', 'last_name' => 'Marcet', 'email' => 'sebastian@tipit.net', ]; $response = $this->action ( "POST", "OAuth2SummitSpeakersApiController@addSpeaker", $params, [], [], [], $headers, json_encode($data) ); $this->assertResponseStatus(201); $content = $response->getContent(); $speaker = json_decode($content); $this->assertTrue($speaker->id > 0); return $speaker; } public function testUpdateSpeaker($summit_id = 23) { $params = [ 'id' => $summit_id, 'speaker_id' => 9161 ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $data = [ 'title' => 'Legend!!!', ]; $response = $this->action ( "PUT", "OAuth2SummitSpeakersApiController@updateSpeaker", $params, [], [], [], $headers, json_encode($data) ); $this->assertResponseStatus(201); $content = $response->getContent(); $speaker = json_decode($content); $this->assertTrue($speaker->id > 0); return $speaker; } }