示例#1
0
 public function testMultiFactory()
 {
     $builds = Build::multiFactory($this->jenkins, "foo", array(array('number' => 42), array('number' => 24), array('number' => "314")));
     $this->assertEquals(3, count($builds));
     $this->assertEquals("/job/foo/42", $builds[0]->url);
     $this->assertEquals("/job/foo/24", $builds[1]->url);
     $this->assertEquals("/job/foo/314", $builds[2]->url);
 }
示例#2
0
 /**
  * (non-PHPdoc)
  * @see \mogman1\Jenkins\ApiObject::updateImpProperties()
  */
 protected function updateImpProperties(JsonData $data)
 {
     //url and name are not updated since, once they are set, they should never change
     //TODO: figure out what actions are
     $this->actions = $data->get('actions', array());
     $this->buildable = $data->get('buildable', TRUE);
     $this->builds = Build::multiFactory($this->conn, $this->name, $data->get('builds', array()));
     $this->color = $data->get('color', "gray");
     $this->concurrentBuild = $data->get('concurrentBuild', FALSE);
     $this->description = $data->get('description', "");
     $this->displayName = $data->get('displayName', "");
     $this->displayNameOrNull = $data->get('displayNameOrNull', NULL);
     $this->downstreamProjects = $data->get('downstreamProjects', array());
     //TODO: create health report object
     $this->healthReport = $data->get('healthReport', array());
     $this->inQueue = $data->get('inQueue', FALSE);
     $this->keepDependencies = $data->get('keepDependencies', FALSE);
     $this->nextBuildNumber = $data->get('nextBuildNumber', "0");
     $this->property = $data->get('property', array());
     $this->queueItem = $data->get('queueItem', NULL);
     $this->scm = $data->get('scm', array());
     $this->upstreamProjects = $data->get('upstreamProjects', array());
     $build = $data->get('firstBuild', array());
     $this->firstBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
     $build = $data->get('lastBuild', array());
     $this->lastBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
     $build = $data->get('lastCompletedBuild', array());
     $this->lastCompletedBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
     $build = $data->get('lastFailedBuild', array());
     $this->lastFailedBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
     $build = $data->get('lastStableBuild', array());
     $this->lastStableBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
     $build = $data->get('lastSuccessfulBuild', array());
     $this->lastSuccessfulBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
     $build = $data->get('lastUnstableBuild', array());
     $this->lastUnstableBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
     $build = $data->get('lastUnsuccessfulBuild', array());
     $this->lastUnsuccessfulBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
 }