예제 #1
0
 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));
 }
예제 #2
0
 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"));
 }
예제 #3
0
 public function testValidateUnknowProductTypeReturnsFalse()
 {
     $this->bfProduct->MasterProductId = "";
     $this->bfProduct->ProductId = "";
     $this->assertFalse($this->bfProductValidator->isComplete($this->bfProduct));
     $this->assertFileExists(TestsHelpers::getUserLog());
 }
예제 #4
0
 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"));
 }
예제 #5
0
 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());
 }
예제 #7
0
 private function getLogContent()
 {
     if (file_exists(TestsHelpers::getUserLog())) {
         return file_get_contents(TestsHelpers::getUserLog());
     }
     return "";
 }
예제 #8
0
 public function setUp()
 {
     $this->db = TestsHelpers::getDb();
     $this->db->setVerboseMode();
     $this->iniParams = TestsHelpers::getIniParams();
     $this->okChannel = new OkChannel($this->iniParams->get("channelId"), $this->db);
 }
예제 #9
0
 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());
 }
예제 #11
0
 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);
 }
예제 #12
0
 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());
 }
예제 #15
0
 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);
 }
예제 #16
0
 public function testCleanAllLogs()
 {
     $logFile = TestsHelpers::getLogDir() . "/test.log";
     file_put_contents($logFile, "fake content");
     $this->assertFileExists($logFile);
     TestsHelpers::cleanAllLogs();
     $this->assertFileNotExists($logFile);
 }
예제 #17
0
 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());
 }
예제 #18
0
 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());
 }
예제 #20
0
 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);
 }
예제 #21
0
 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);
 }
예제 #22
0
 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);
 }
예제 #23
0
 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);
 }
예제 #24
0
 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"));
 }
예제 #25
0
 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());
 }
예제 #27
0
 public function setup()
 {
     $this->logger = LoggerFactory::getFileLogger(TestsHelpers::getUserLog(), Logger::WARNING);
 }
예제 #28
0
 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]);
 }
예제 #29
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();
 }
예제 #30
0
 protected function setUp()
 {
     $this->db = TestsHelpers::getDb();
 }