persist(self::$summit); self::$em->flush(); } protected function tearDown() { self::clearTestData(); parent::tearDown(); } public function testSubmitPresentation(){ $params = [ 'id' => self::$summit->getId(), ]; $title = str_random(16).'_presentation'; $data = [ 'title' => $title, 'description' => 'this is a description', 'social_description' => 'this is a social description', 'level' => 'N/A', 'attendees_expected_learnt' => 'super duper', 'type_id' => self::$defaultEventType->getId(), 'track_id' => self::$defaultTrack->getId(), 'attending_media' => true, 'links' => ['https://www.google.com'], //'tags' => ['Upstream Development'] ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "POST", "OAuth2PresentationApiController@submitPresentation", $params, [], [], [], $headers, json_encode($data) ); $content = $response->getContent(); $this->assertResponseStatus(201); $presentation = json_decode($content); $this->assertTrue(!is_null($presentation)); $this->assertEquals($title, $presentation->title); $params = [ 'id' => self::$summit->getId(), 'presentation_id' => $presentation->id ]; $response = $this->action( "PUT", "OAuth2PresentationApiController@completePresentationSubmission", $params, [], [], [], $headers ); return $presentation; } /** * @param int $summit_id */ public function testDeletePresentation($summit_id = 25){ $new_presentation = $this->testSubmitPresentation($summit_id); $params = [ 'id' => $summit_id, 'presentation_id' => $new_presentation->id, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "DELETE", "OAuth2PresentationApiController@deletePresentation", $params, [], [], [], $headers, '' ); $content = $response->getContent(); $this->assertResponseStatus(204); } public function testImportAssetsFromMUX(){ $params = [ 'id' => self::$summit->getId(), ]; $data = [ 'mux_token_id' => "TOKEN", 'mux_token_secret' => "SECRET", "email_to" => "test@test.com" ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "POST", "OAuth2PresentationApiController@importAssetsFromMUX", $params, [], [], [], $headers, json_encode($data) ); $content = $response->getContent(); $this->assertResponseStatus(200); } }