23, 'page' => 1, 'per_page' => 10, 'filter' => 'code=@DISCOUNT_', 'order' => '+code' ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "GET", "OAuth2SummitPromoCodesApiController@getAllBySummit", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(200); $promo_codes = json_decode($content); $this->assertTrue(!is_null($promo_codes)); } public function testGetPromoCodesByClassNameSpeakerSummitRegistrationPromoCode(){ $params = [ 'id' => 23, 'page' => 1, 'per_page' => 10, 'filter' => 'class_name=='.\models\summit\SpeakerSummitRegistrationPromoCode::ClassName, 'order' => '+code' ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "GET", "OAuth2SummitPromoCodesApiController@getAllBySummit", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(200); $promo_codes = json_decode($content); $this->assertTrue(!is_null($promo_codes)); } public function testGetPromoCodesByClassNameOR(){ $params = [ 'id' => 23, 'page' => 1, 'per_page' => 10, 'filter' => [ 'class_name=='.\models\summit\SpeakerSummitRegistrationPromoCode::ClassName.','. 'class_name=='.\models\summit\MemberSummitRegistrationPromoCode::ClassName, ], 'order' => '+code' ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "GET", "OAuth2SummitPromoCodesApiController@getAllBySummit", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(200); $promo_codes = json_decode($content); $this->assertTrue(!is_null($promo_codes)); } public function testGetPromoCodesByClassNameORInvalidClassName(){ $params = [ 'id' => 23, 'page' => 1, 'per_page' => 10, 'filter' => [ 'class_name=='.\models\summit\SpeakerSummitRegistrationPromoCode::ClassName.','. 'class_name==invalid' ], 'order' => '+code' ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "GET", "OAuth2SummitPromoCodesApiController@getAllBySummit", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(412); } public function testGetPromoCodesFilterByEmailOwner(){ $params = [ 'id' => 23, 'page' => 1, 'per_page' => 10, 'filter' => [ 'speaker_email=@muroi', ], 'order' => '+code', 'expand' => 'speaker,creator' ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "GET", "OAuth2SummitPromoCodesApiController@getAllBySummit", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(200); $promo_codes = json_decode($content); $this->assertTrue(!is_null($promo_codes)); } public function testGetPromoCodesMetadata(){ $params = [ 'id' => 23, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "GET", "OAuth2SummitPromoCodesApiController@getMetadata", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(200); $metadata = json_decode($content); $this->assertTrue(!is_null($metadata)); } }