/** * Create a new organization */ public function postAction() { // Avoid setting custom id $data = $this->_helper->requestData(true); $data = $this->_helper->filter($data)->blacklist(array('id', 'status')); $org = OrgModelFactory::factory($data); // Check if it's allowed $this->_helper->allowed('create', $org); // Create the organization via its service $this->_orgSrv->create($org); // Response with the organization id $this->view->data = $org->getId(); }
public function testCrud() { // Creare new org $org = new OrgCustomerModel($this->_data); try { $this->_service->create($org); } catch (ValidateException $e) { $this->fail("Fail creating org: " . var_export($e->getValidationErrors(), true)); } try { // Update it (changeBillingCycleStartDay integration) $this->_service->update($org); } catch (ValidateException $e) { $this->fail("Fail updating org: " . var_export($e->getValidationErrors(), true)); } try { // Remove it // $this->_service->delete($org); } catch (ValidateException $e) { $this->fail("Fail deleting org: " . var_export($e->getValidationErrors(), true)); } }
public function testCreateNewOrgWithParent() { $this->_org->setParentId(self::SUPER_ORG_ID); $this->_service->create($this->_org); $this->assertNotNull($this->_org->getId()); }
/** * @expectedException \Application\Exceptions\ValidateException */ public function testCreateNewOrgInexistendOrgTypeParentId() { $this->_org->setParentId(self::INEXISTENT_ORG_ID); $this->_service->create($this->_org); }