public function setUP() { $username = getenv('END_USER_USERNAME'); $password = getenv('END_USER_PASSWORD'); $client_end_user = new Client($this->subdomain, $username); $client_end_user->setAuth('password', $password); $testTicket = array('subject' => 'Activity Stream Test', 'comment' => array('body' => 'ce est biche Actions test.'), 'priority' => 'normal'); $request = $client_end_user->requests()->create($testTicket); $this->ticket_id = $request->request->id; }
public function setUp() { // Auth as end user $username = getenv('END_USER_USERNAME'); $password = getenv('END_USER_PASSWORD'); $client_end_user = new Client($this->subdomain, $username); $client_end_user->setAuth('password', $password); $testTicket = array('subject' => 'Satisfaction Ratings Test', 'comment' => array('body' => 'Dette er for tilfredshed ratings test.'), 'priority' => 'normal'); $request = $client_end_user->requests()->create($testTicket); $this->ticket_id = $request->request->id; // Agent set ticket status to be solved $testTicket['status'] = 'solved'; $this->client->ticket($this->ticket_id)->update($testTicket); $rating = $client_end_user->ticket($this->ticket_id)->satisfactionRatings()->create(array('score' => 'good', 'comment' => 'Awesome support')); $this->assertEquals(is_object($rating), true, 'Should return an object'); $this->assertEquals(is_object($rating->satisfaction_rating), true, 'Should return an object called "satisfaction_rating"'); $this->assertGreaterThan(0, $rating->satisfaction_rating->id, 'Returns a non-numeric id for satisfaction_rating'); $this->assertEquals($rating->satisfaction_rating->score, 'good', 'Score of test rating does not match'); $this->assertEquals($client_end_user->getDebug()->lastResponseCode, '200', 'Does not return HTTP code 200'); $this->id = $rating->satisfaction_rating->id; }