Esempio n. 1
0
 public function testGetThrowsExceptionOnHttpResponseError()
 {
     $this->Server->queueResponse("HTTP/1.1 205 Kaboom Fool\r\n\r\nhi");
     $this->Server->queueResponse("HTTP/1.1 404 Not Found\r\n\r\nhi");
     $this->Server->queueResponse("HTTP/1.1 200 OK\r\n\r\nhi");
     $this->Server->queueResponse("HTTP/1.1 201 Created\r\n\r\nhi");
     try {
         $this->jenkins->get("/");
         $this->fail("No JenkinsConnectionException thrown");
     } catch (JenkinsConnectionException $e) {
     }
     try {
         $this->jenkins->get("/");
         $this->fail("No JenkinsConnectionException thrown");
     } catch (JenkinsConnectionException $e) {
     }
     $resp = $this->jenkins->get("/");
     $resp2 = $this->jenkins->get("/");
     $this->assertInstanceOf('mogman1\\Jenkins\\Server\\HttpResponse', $resp);
     $this->assertInstanceOf('mogman1\\Jenkins\\Server\\HttpResponse', $resp2);
 }
Esempio n. 2
0
 /**
  * Updates object with information coming from Jenkins server
  * @throws InvalidApiObjectException
  */
 public function update()
 {
     $jsonData = $this->conn->get($this->url)->getJson();
     $this->updateProperties($jsonData);
 }