Example #1
0
 private function checkLogin()
 {
     $this->client->api('user')->getCurrentUser();
     if ($this->client->getResponseCode() == 401) {
         throw new \Exception('Invalid Redmine credentials.', 401);
     }
 }
Example #2
0
 /**
  * Returns whether or not the last api call failed.
  *
  * @return bool
  */
 public function lastCallFailed()
 {
     $code = $this->client->getResponseCode();
     return 200 !== $code && 201 !== $code;
 }
Example #3
0
 /**
  * @covers Redmine\Client
  * @test
  */
 public function testGetResponseCodeIsInitialNull()
 {
     $client = new Client('http://test.local', 'asdf');
     $this->assertEquals(0, $client->getResponseCode());
 }
 /**
  * Returns whether or not the last api call failed.
  * @return bool
  */
 public function lastCallFailed()
 {
     $code = $this->client->getResponseCode();
     return 200 < $code || $code >= 400;
 }