public function testUpdateThrowsException() { try { $view = new View($this->jenkins, "/", "test"); $view->update(); $this->fail("No RuntimeException thrown"); } catch (\RuntimeException $e) { $this->assertEquals("update not implemented for views", $e->getMessage()); } }
/** * Constructs an array of views from data, which is assumed to be an array of data that * would have come from a Jenkins API call * * @param Jenkins $conn * @param array $data * @return array[\mogman1\Jenkins\View] */ public static function multiFactory(Jenkins $conn, array $data) { $views = array(); foreach ($data as $viewData) { $views[] = View::factory($conn, new JsonData($viewData)); } return $views; }
protected function updateImpProperties(JsonData $data) { $this->assignedLabels = $data->get('assignedLabels', array()); $this->description = $data->get('description'); $this->jobs = Job::multiFactory($this->conn, $data->get('jobs', array())); $this->mode = $data->get('mode', "UNKNOWN"); $this->nodeDescription = $data->get('nodeDescription'); $this->nodeName = $data->get('nodeName'); $this->numExecutors = $data->get('numExecutors', 0); $this->overallLoad = $data->get('overallLoad', array()); $this->quietingDown = $data->get('quietingDown', FALSE); $this->slaveAgentPort = $data->get('slaveAgentPort', 0); $this->unlabeledLoad = $data->get('unlabeledLoad', array()); $this->useCrumbs = $data->get('useCrumbs', FALSE); $this->useSecurity = $data->get('useSecurity', FALSE); $this->views = View::multiFactory($this->conn, $data->get('views', array())); $viewData = $data->get('primaryView', array()); $this->primaryView = $viewData ? View::factory($this->conn, new JsonData($data->get('primaryView', array()))) : NULL; }