public function testFormatName() { $nameMaxLength = TestsHelpers::getXChars(100); $this->assertEquals(TestsHelpers::getXChars(100), BfDataFormatter::formatName($nameMaxLength)); $nameTooLong = TestsHelpers::getXChars(101); $this->assertEquals($nameMaxLength, BfDataFormatter::formatName($nameTooLong)); }
public function testExportWithInvalidData() { $this->okProductsUpdatesArray[0]->sku = TestsHelpers::getXChars(50); $this->xmlExporter = new ProductsUpdates($this->iniParams, $this->okProductsUpdatesArray, $this->logger); $this->xmlExporter->generateXml($this->fileName); $this->assertTrue(TestsHelpers::testUserLogContains("Skipping following product update")); }
public function testValidateUnknowProductTypeReturnsFalse() { $this->bfProduct->MasterProductId = ""; $this->bfProduct->ProductId = ""; $this->assertFalse($this->bfProductValidator->isComplete($this->bfProduct)); $this->assertFileExists(TestsHelpers::getUserLog()); }
public function testExportWithInvalidData() { $this->okOrdersStatusesArray[0]->order_id = TestsHelpers::getXChars(50); $this->xmlExporter = new OrdersStatuses($this->iniParams, $this->okOrdersStatusesArray, $this->logger); $this->xmlExporter->generateXml($this->fileName); $this->assertTrue(TestsHelpers::testUserLogContains("Skipping following order status")); }
public function testMapWithInvalidDataThrowsException() { $this->setExpectedException("E7\\Helpers\\Exceptions\\XmlItemMapperException", "invalid data <" . TestsHelpers::getXChars(300) . "> for <OrderId> of type <ID>"); $okOrdersStatusesArray = $this->getOkOrdersStatuses(1); $okOrdersStatusesArray[0]->order_id = TestsHelpers::getXChars(300); $bfOrderStatus = $this->xmlItemMapper->map($okOrdersStatusesArray[0]); }
protected function setUp() { $this->db = TestsHelpers::getDb(); $iniParams = TestsHelpers::getIniParams(); $this->okChannel = new OkChannel($iniParams->get("channelId"), $this->db); $this->dataProvider = new OkManufacturersDataProvider($this->db, $this->okChannel->getLanguageId()); }
private function getLogContent() { if (file_exists(TestsHelpers::getUserLog())) { return file_get_contents(TestsHelpers::getUserLog()); } return ""; }
public function setUp() { $this->db = TestsHelpers::getDb(); $this->db->setVerboseMode(); $this->iniParams = TestsHelpers::getIniParams(); $this->okChannel = new OkChannel($this->iniParams->get("channelId"), $this->db); }
protected function setUp() { $this->db = TestsHelpers::getDb(); $this->iniParams = TestsHelpers::getIniParams(); $systemLogger = LoggerFactory::getFileLogger(TestsHelpers::getSystemLog(), Logger::INFO); $this->connectorSet = new OkToBf($this->iniParams, $systemLogger); $this->connector = null; }
public function testValidateWithoutOrderStatusReturnsFalse() { $this->bfOrderStatus->ProductStoreId = "BF_STORE"; $this->bfOrderStatus->OrderId = "BF0001"; $this->bfOrderStatus->OrderStatus = ""; $this->assertFalse($this->bfOrderStatusValidator->isComplete($this->bfOrderStatus)); $this->assertFileExists(TestsHelpers::getUserLog()); }
public function testMapManufacturerWithInvalidDataThrowsException() { $this->setExpectedException("E7\\Helpers\\Exceptions\\XmlItemMapperException", "invalid data <ZDE" . TestsHelpers::getXChars(300) . "> for <ManufacturerId> of type <ID>"); $okManufacturersArray = $this->getOkManufacturers(1); $okManufacturer = $okManufacturersArray[0]; $okManufacturer->manufacturers_id = TestsHelpers::getXChars(300); $bfManufacturer = $this->xmlItemMapper->map($okManufacturer); }
protected function setUp() { $iniParams = TestsHelpers::getIniParams(); $this->ftpHost = $iniParams->get("ftpHost"); $this->ftpUser = $iniParams->get("ftpUser"); $this->ftpPass = $iniParams->get("ftpPass"); $this->ftp = new Ftp($this->ftpHost, $this->ftpUser, $this->ftpPass); }
protected function setUp() { $this->db = TestsHelpers::getDb(); $this->db->setVerboseMode(); $this->iniParams = TestsHelpers::getIniParams(); $this->okChannel = new OkChannel($this->iniParams->get("channelId"), $this->db); $this->logger = LoggerFactory::getFileLogger(TestsHelpers::getUserLog(), Logger::WARNING); }
protected function setUp() { $this->db = TestsHelpers::getDb(); $this->db->setVerboseMode(); $this->iniParams = TestsHelpers::getIniParams(); $this->okChannel = new OkChannel($this->iniParams->get("channelId"), $this->db); $this->dataProvider = new OkCategoriesDataProvider($this->db, $this->okChannel->getLanguageId()); }
public function testMapCategoryWithInvalidDataThrowsException() { $this->setExpectedException("E7\\Helpers\\Exceptions\\XmlItemMapperException", "invalid data <http://images.client.com/images/" . TestsHelpers::getXChars(300) . "> for <PlpImage/Url> of type <VARCHAR_255>"); $okCategoriesArray = $this->getOkCategories(1); $okCategory = $okCategoriesArray[0]; $okCategory->categories_image = TestsHelpers::getXChars(300); $bfCategory = $this->xmlItemMapper->map($okCategory); }
public function testCleanAllLogs() { $logFile = TestsHelpers::getLogDir() . "/test.log"; file_put_contents($logFile, "fake content"); $this->assertFileExists($logFile); TestsHelpers::cleanAllLogs(); $this->assertFileNotExists($logFile); }
public function testValidateWithoutDescriptionReturnsFalse() { $this->bfCategory->CategoryId = "CLIENT_MEDIAS"; $this->bfCategory->ParentCategoryId = "BF_CATEGORY_ROOT"; $this->bfCategory->CategoryName = "Médias Vierges"; $this->bfCategory->Description = ""; $this->assertFalse($this->bfCategoryValidator->isComplete($this->bfCategory)); $this->assertFileExists(TestsHelpers::getUserLog()); }
public function testRemoveOrphan_RemovesProductWithoutManufacturer() { $this->okProductsArray[2]->products_manufacturers_id = "UNKNOWN"; $productsFilter = new OkProductsFilter($this->okManufacturersArray, $this->logger); $productsWithoutOrphans = $productsFilter->removeOrphans($this->okProductsArray); $this->assertEquals(count($this->okProductsArray) - 1, count($productsWithoutOrphans)); TestsHelpers::testUserLogContains("Product <PROD3> has unresolved Manufacturer <UNKNOWN> dependency"); TestsHelpers::testUserLogContains("Removing product <PROD3> : <stdClass Object( [sku] => PROD3 [products_manufacturers_id] => UNKNOWN)>"); }
protected function setUp() { $this->db = TestsHelpers::getDb(); $iniParams = TestsHelpers::getIniParams(); $this->okChannel = new OkChannel($iniParams->get("channelId"), $this->db); $this->dataProvider = new OkOrdersStatusDataProvider($this->db, $this->okChannel->getCustomersId()); // we have to set the shipping date so the feed returns results $sql = "UPDATE shipping_orders SET shipping_date = NOW()"; $this->db->execute($sql, array()); }
public function testLogError() { try { throw new E7Exception("test de log d'erreur"); } catch (E7Exception $e) { ExceptionsHandler::logError($e, $this->systemLogger); } $this->assertFileExists(TestsHelpers::getSystemLog()); $logContent = file_get_contents(TestsHelpers::getSystemLog()); $this->assertContains("fLog.ERROR: E7\\Helpers\\Exceptions\\E7Exception", $logContent); }
public function testExecuteFail() { $sqlWithError = "THIS IS NOT AN SQL QUERY"; try { $this->db->execute($sqlWithError, array()); } catch (E7Exception $e) { ExceptionsHandler::logError($e, $this->systemLogger); } $this->assertFileExists(TestsHelpers::getSystemLog()); $logContent = file_get_contents(TestsHelpers::getSystemLog()); $this->assertContains("SQL error", $logContent); }
public function testFileAndMailLogger() { $systemLog = TestsHelpers::getSystemLog(); $this->log = LoggerFactory::getFileAndMailLogger($systemLog, Logger::ERROR, "*****@*****.**", Logger::ERROR); $this->assertInstanceOf("E7\\Helpers\\Logger", $this->log); $this->log->info("test info ééé Straße"); $this->log->warning("test warning ààà Straße"); $this->log->error("test error ùùù Straße"); $logContent = file_get_contents($systemLog); $this->assertNotContains("test info ééé Straße", $logContent); $this->assertNotContains("test warning ààà Straße", $logContent); $this->assertContains("test error ùùù Straße", $logContent); }
protected function setUp() { $this->db = TestsHelpers::getDb(); //$this->db->setVerboseMode(); $this->logger = LoggerFactory::getFileLogger(TestsHelpers::getUserLog(), Logger::INFO); $this->iniParams = TestsHelpers::getIniParams(); $this->okChannel = new OkChannel($this->iniParams->get("channelId"), $this->db); $this->xmlImporter = new Orders($this->okChannel, $this->iniParams, $this->db, $this->logger); $bfOrderDataProvider = new BfOrderDataProvider(__DIR__ . '/Data/orders.xml'); $this->bfOrdersArray = $bfOrderDataProvider->getOrders(); $locale = $this->iniParams->get("locale"); I18n::setLocale($locale); self::deleteTestsOrders($this->iniParams, $this->db); }
public function putIntoIfValidFail() { return array(array("CategoryId", TestsHelpers::getXChars(21)), array("Varchar60", TestsHelpers::getXChars(61)), array("Varchar100", TestsHelpers::getXChars(101)), array("Varchar255", TestsHelpers::getXChars(256)), array("Indicator", "y"), array("Indicator", "n"), array("Indicator", "a"), array("Indicator", "A"), array("Decimal3", 1.1234), array("Decimal6", 1.1234567), array("Integer", "a"), array("Datetime", "2014-06-31 00:00:00")); }
public static function getFtpConnection() { $iniParams = TestsHelpers::getIniParams(); $ftp = new Ftp($iniParams->get("ftpHost"), $iniParams->get("ftpUser"), $iniParams->get("ftpPass")); return $ftp; }
public function testValidateWithoutManufacturerIdReturnsFalse() { $this->bfManufacturer->ManufacturerId = ""; $this->assertFalse($this->bfManufacturerValidator->isComplete($this->bfManufacturer)); $this->assertFileExists(TestsHelpers::getUserLog()); }
public function setup() { $this->logger = LoggerFactory::getFileLogger(TestsHelpers::getUserLog(), Logger::WARNING); }
public function testMapProductWithInvalidDataThrowsException() { $this->setExpectedException("E7\\Helpers\\Exceptions\\XmlItemMapperException", "invalid data <" . TestsHelpers::getXChars(300) . "> for <InternalName> of type <VARCHAR_255>"); $okProductsArray = $this->getOkProducts(__DIR__ . "/Data/availability-import-data-01.csv"); $okProductsArray[0]->products_products_model = TestsHelpers::getXChars(300); $bfProduct = $this->xmlItemMapper->map($okProductsArray[0]); }
public function testGenerateColumnsToValuesArray() { $this->tableRow->intcol = 3; $this->tableRow->floatcol = array(); $this->tableRow->varchar32 = "123456789"; $this->tableRow->datetimecol = "2014-01-01 00:00:00"; $this->tableRow->shouldntexists = "I'm not there !"; // $this->tableRow->varchar32 is intentionally not set unset($this->tableRow->datetimecol); $columnsToValue = $this->tableRow->_generateColumnsToValuesArray(); $this->assertEquals(2, count($columnsToValue)); $this->assertEquals(3, $columnsToValue["intcol"]); $this->assertEquals("123456789", $columnsToValue["varchar32"]); $logContent = file_get_contents(TestsHelpers::getUserLog()); $this->assertContains('Invalid decimal value : <Array()>', $logContent); $this->cleanAllLogs(); }
protected function setUp() { $this->db = TestsHelpers::getDb(); }