public function setUp() { $this->_mapper = OrgServiceProviderMapper::getInstance(); $this->_model = new OrgServiceProviderModel(); $this->_parentModel = new OrgMasterModel(); $data = array('name' => 'SP' . microtime(), 'description' => "Description", 'commercialName' => 'Service provider commercial name' . microtime(true), 'status' => OrgServiceProviderModel::ORG_STATUS_ACTIVATED, 'defaultLanguage' => 'es', 'GGSNProvisioning' => true, 'pluralSIMProvisioning' => false, 'fiscalNumber' => 'X4543545643', 'countryVATNumber' => '45634556', 'brand' => '777', 'primaryContact' => array('firstName' => 'Pepe', 'lastName' => 'González', 'phone' => '934443344', 'email' => '*****@*****.**', 'mobile' => '655445533', 'fax' => '934443344'), 'billingAddress' => array('line1' => 'name line here', 'line2' => 'name line here', 'city' => 'Barcelona', 'state' => 'Catalonia', 'country' => 'ES', 'postalCode' => '08080'), 'shippingAddress' => array('line1' => 'line1', 'line2' => 'line2', 'city' => 'Barcelona', 'state' => 'Catalonia', 'country' => 'ES', 'postalCode' => '08080'), 'companyAddress' => array('line1' => 'line1', 'line2' => 'line2', 'city' => 'Barcelona', 'state' => 'Catalonia', 'country' => 'ES', 'postalCode' => '08080')); $parentData = array('name' => 'ORG_TEST_PARENT' . microtime(true), 'description' => "Description", 'status' => OrgMasterModel::ORG_STATUS_ACTIVATED, 'defaultLanguage' => "es", 'type' => OrgMasterModel::ORG_TYPE, 'primaryContact' => array('firstName' => 'pcfn', 'lastName' => 'pcln', 'phone' => '933453212', 'email' => '*****@*****.**', 'mobile' => '665348765', 'fax' => '933453232'), 'companyAddress' => array('line1' => 'line1', 'line2' => 'line2', 'city' => 'Barcelona', 'state' => 'Catalunya', 'country' => 'ES', 'postalCode' => '08005')); $this->_model->importData($data); $this->_parentModel->importData($parentData); // If the org was persisted delete it try { $org = $this->_mapper->findOneByName($this->_model->getName()); if ($org) { try { $org->delete(); } catch (Exception $e) { fputs(STDOUT, "WARNING: Deleting organization error\n"); } } } catch (Exception $e) { fputs(STDOUT, "WARNING: Finding by name organization error\n"); } }
public function testImportOrgData() { $org = new Organization\OrgMasterModel(); $org->importData($this->_data); $this->assertNotNull($org, "Not null from import."); $this->checkModelAgainstStruct($org, 'import with importData'); $this->assertInstanceOf('\\Application\\Model\\Organization\\OrgMasterModel', $org); // or $org = new Organization\OrgMasterModel($this->_data); $this->assertNotNull($org, "Not null from constructor."); $this->checkModelAgainstStruct($org, 'import with constructor'); $this->assertInstanceOf('\\Application\\Model\\Organization\\OrgMasterModel', $org); // or $org = \Application\Model\OrgModelFactory::factory($this->_data); $this->assertNotNull($org, "Not null from factory."); $this->checkModelAgainstStruct($org, 'import with factory'); $this->assertInstanceOf('\\Application\\Model\\Organization\\OrgMasterModel', $org); }
public function testImportOrgData() { $this->markTestIncomplete(); // TODO: Shouldn't this be OrgEndUserModel???? $org = new Organization\OrgMasterModel(); $org->importData($this->_data); $this->checkModelAgainstStruct($org, 'import with importData'); $this->assertNotNull($org); $this->assertInstanceOf('\\Application\\Model\\Organization\\OrgMasterModel', $org); // or // TODO: Shouldn't this be OrgEndUserModel???? $org = new Organization\OrgMasterModel($this->_data); $this->checkModelAgainstStruct($org, 'import with constructor'); $this->assertNotNull($org); $this->assertInstanceOf('\\Application\\Model\\Organization\\OrgMasterModel', $org); // or // TODO: Shouldn't this be OrgEndUserModel???? $org = \Application\Model\OrgModelFactory::factory($this->_data); $this->checkModelAgainstStruct($org, 'import with factory'); $this->assertNotNull($org); $this->assertInstanceOf('\\Application\\Model\\Organization\\OrgMasterModel', $org); }