コード例 #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]);
 }
コード例 #6
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
ファイル: StringTest.php プロジェクト: no-chris/connector
 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
ファイル: OkToBfTest.php プロジェクト: no-chris/connector
 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;
 }
コード例 #10
0
 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
ファイル: FtpTest.php プロジェクト: no-chris/connector
 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);
 }
コード例 #13
0
 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);
 }
コード例 #14
0
 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
ファイル: LoggerTest.php プロジェクト: no-chris/connector
 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)>");
 }
コード例 #19
0
 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
ファイル: DbTest.php プロジェクト: no-chris/connector
 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
ファイル: OrdersTest.php プロジェクト: no-chris/connector
 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
ファイル: TestsHelpers.php プロジェクト: no-chris/connector
 public static function getFtpConnection()
 {
     $iniParams = TestsHelpers::getIniParams();
     $ftp = new Ftp($iniParams->get("ftpHost"), $iniParams->get("ftpUser"), $iniParams->get("ftpPass"));
     return $ftp;
 }
コード例 #26
0
 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
ファイル: TableRowTest.php プロジェクト: no-chris/connector
 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
ファイル: OkCountryTest.php プロジェクト: no-chris/connector
 protected function setUp()
 {
     $this->db = TestsHelpers::getDb();
 }