addMember(self::$member); self::$em->persist(self::$summit); self::$em->persist(self::$summit_permission_group); self::$em->flush(); } protected function tearDown() { self::clearMemberTestData(); self::clearTestData(); parent::tearDown(); } public function testAddExtraOrderQuestion(){ $params = [ 'id' => self::$summit->getId() ]; $name = str_random(16).'_question'; $data = [ 'name' => $name, 'type' => SummitOrderExtraQuestionTypeConstants::ComboBoxQuestionType, 'label' => $name, 'usage' => SummitOrderExtraQuestionTypeConstants::BothQuestionUsage, 'mandatory' => true, 'printable' => true, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "POST", "OAuth2SummitOrderExtraQuestionTypeApiController@add", $params, [], [], [], $headers, json_encode($data) ); $content = $response->getContent(); $this->assertResponseStatus(201); $question = json_decode($content); $this->assertTrue(!is_null($question)); return $question; } public function testAddQuestionValue(){ $params = [ 'id' => self::$summit->getId() ]; $name = str_random(16).'_question'; $data = [ 'name' => $name, 'type' => SummitOrderExtraQuestionTypeConstants::ComboBoxQuestionType, 'label' => $name, 'usage' => SummitOrderExtraQuestionTypeConstants::BothQuestionUsage, 'mandatory' => true, 'printable' => true, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "POST", "OAuth2SummitOrderExtraQuestionTypeApiController@add", $params, [], [], [], $headers, json_encode($data) ); $content = $response->getContent(); $this->assertResponseStatus(201); $question = json_decode($content); $this->assertTrue(!is_null($question)); $params = [ 'id' => self::$summit->getId(), 'question_id' => $question->id ]; $name = str_random(16).'_question'; $data = [ 'value' => $name, 'label' => $name, ]; $headers = [ "HTTP_Authorization" => " Bearer " . $this->access_token, "CONTENT_TYPE" => "application/json" ]; $response = $this->action( "POST", "OAuth2SummitOrderExtraQuestionTypeApiController@addQuestionValue", $params, [], [], [], $headers, json_encode($data) ); $content = $response->getContent(); $this->assertResponseStatus(201); $question = json_decode($content); $this->assertTrue(!is_null($question)); return $question; } }