assertNotEmpty($questions, 'Should have returned some questions'); } public function testGetAllQuestionsWithCustomerAnswers() { $api = new CrmApiV2(); $customer = $api->getCustomerOrNew(static::$info->hashcode); $questions = Question::allWithCustomerAnswers($customer); $this->assertNotEmpty($questions, 'Should have returned some questions'); } public function testGetAllCustomerUnAnsweredQuestions() { $api = new CrmApiV2(); $customer = $api->getCustomerOrNew(static::$info->hashcode); $questions = Question::unansweredBy($customer); $this->assertNotEmpty($questions, 'Should have returned some questions'); } public function testSubmitCustomerAnswer() { $questions = Question::all(); $api = new CrmApiV2(); $customer = $api->getCustomerOrNew(static::$info->hashcode); $result = Answer::setQuestionAnswers( $customer->hashcode, $questions[0]->id, [ $questions[0]->answers[0]->id, $questions[0]->answers[1]->id ] ); $this->assertTrue($result); } public function testGetAllCustomerUnansweredQuestionsShouldNotContainFirst() { $this->expectNotToPerformAssertions(); $unWantedQuestion = Question::all()[0]; $api = new CrmApiV2(); $customer = $api->getCustomerOrNew(static::$info->hashcode); $questions = Question::unansweredBy($customer); foreach ($questions as $question) { if ($unWantedQuestion->id === $question->id) { throw new Exception('The question should not appear'); } } } public function testGetAllQuestionsWithCustomerAnswersShouldHaveAnswers() { $api = new CrmApiV2(); $customer = $api->getCustomerOrNew(static::$info->hashcode); $questions = Question::allWithCustomerAnswers($customer); $this->assertNotEmpty($questions[0]['customerAnswers'], 'Should have customer answers'); } }