Esempio n. 1
0
 /**
  * @param $ticket_id
  * @return bool
  */
 public function updateIssue($ticket_id)
 {
     $this->logger->debug(sprintf('Start github comment creation for ticket #%s', $ticket_id));
     $internal = $this->isKnownTicket($ticket_id);
     if (null === $internal) {
         $this->logger->error(sprintf('unable to find matching record for ticket #%s', $ticket_id));
         return false;
     }
     try {
         $comments = $this->zClient->ticket($ticket_id)->comments()->findAll();
         if (is_array($comments->comments)) {
             $last = array_pop($comments->comments);
             $this->createGithubComment($internal, $last);
             return true;
         }
         return false;
     } catch (\Exception $e) {
         $this->logger->error($this->zClient->getDebug());
         return false;
     }
 }
 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;
 }