$summit_id, ]; $name = str_random(16).'_feature_type'; $template = << image/svg+xml HTML; $data = [ 'name' => $name, 'description' => "this is a description", 'template_content' => $template, 'tag_name' => "vegan", ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "POST", "OAuth2SummitBadgeFeatureTypeApiController@add", $params, [], [], [], $headers, json_encode($data) ); $content = $response->getContent(); $this->assertResponseStatus(201); $feature = json_decode($content); $this->assertTrue(!is_null($feature)); $this->assertTrue($feature->name == $name); return $feature; } public function testUpdateBadgeFeatureType($summit_id = 27){ $feature_old = $this->testAddBadgeFeatureType(); $params = [ 'id' => $summit_id, "feature_id" => $feature_old->id ]; $data = [ 'description' => "this is a description update", 'is_default' => false, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "PUT", "OAuth2SummitBadgeFeatureTypeApiController@update", $params, [], [], [], $headers, json_encode($data) ); $content = $response->getContent(); $this->assertResponseStatus(201); $feature = json_decode($content); $this->assertTrue(!is_null($feature)); $this->assertTrue($feature->name == $feature_old->name); return $feature; } public function testGetAllBySummit($summit_id=27){ $params = [ 'id' => $summit_id, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "GET", "OAuth2SummitBadgeFeatureTypeApiController@getAllBySummit", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(200); $data = json_decode($content); $this->assertTrue(!is_null($data)); return $data; } /** * @param int $summit_id */ public function testDeleteAccessLevel($summit_id=27){ $feature_old = $this->testAddBadgeFeatureType(); $params = [ 'id' => $summit_id, "feature_id" => $feature_old->id ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "DELETE", "OAuth2SummitBadgeFeatureTypeApiController@delete", $params, [], [], [], $headers ); $content = $response->getContent(); $this->assertResponseStatus(204); } }