/** * @param null|ProjectsFilter $data * @return null|void */ public function projects($data = null) { $action = 'projects'; $postMainParameters = null; if ($data instanceof ProjectsFilter) { $this->addMainParameter($data->getId()); $this->addSecondaryParameter('extend', $data->getExtend()); if ($data->isWorkflow() && null !== $data->getId()) { $postMainParameters = 'workflow'; $this->addSecondaryParameter('item_type', $data->getItemType()); } elseif ($data->isAttachments() && null !== $data->getId()) { $postMainParameters = 'attachments'; } } elseif (is_int($data)) { $this->addMainParameter($data); } $response = $this->call($action, $postMainParameters); $result = $this->handleResponse($response); return $result; }
/** * */ public function testProjects() { $ot = $this->getOnTimeObjectOk(); $resultT1 = $ot->projects(); $this->assertTrue(is_array($resultT1['data'])); // $ot = $this->getOnTimeObjectOk(); $filterT2 = new Projects(); $resultT2 = $ot->projects($filterT2); $this->assertTrue(is_array($resultT2['data'])); // $ot = $this->getOnTimeObjectOk(); $filterT3 = new Projects(); $filterT3->setId(2); $resultT3 = $ot->projects($filterT3); $this->assertTrue(is_array($resultT3['data'])); }