getCustomer()); $response = $this->callApiWithToken($service, 'get', route('apiV2.questions.index')); $json = $response->decodeResponseJson(); $this->assertApiResponseStatusIs($json, ApiStatus::OK()); } /** * route: apiV2.questions.indexWithResponse */ public function testQuestionIndexWithAnswers() { extract($this->getCustomer(true, false)); $service = $brand->services()->firstOrFail(); $response = $this->callApiWithToken($service, 'get', route( 'apiV2.questions.indexWithResponse', ['customer' => $info->hashcode] )); $json = $response->decodeResponseJson(); $this->assertApiResponseStatusIs($json, ApiStatus::OK()); } /** * route: apiV2.questions.unAnsweredBy */ public function testCustomerUnAnsweredIndex() { extract($this->getCustomer()); $service = $brand->services()->firstOrFail(); $response = $this->callApiWithToken($service, 'get', route( 'apiV2.questions.unAnsweredBy', ['customer' => $info->hashcode] )); $json = $response->decodeResponseJson(); $this->assertApiResponseStatusIs($json, ApiStatus::OK()); } /** * route: apiV2.customers.answers.store */ public function testQuestionSetAnswer() { extract($this->getCustomer(true, false)); $question = Question::whereHas('brand', function ($q) use ($brand) { $q->whereId($brand->id); })->inRandomOrder()->firstOrFail(); $answer = $question->answers->first(); $response = $this->callApiWithToken($service, 'post', route('apiV2.customers.answers.store', [ 'customer' => $info->hashcode ]), [ 'question' => $question->id, 'answers' => [$answer->id] ]); $json = $response->decodeResponseJson(); $this->assertApiResponseStatusIs($json, ApiStatus::OK()); } }