Пример #1
0
 private function getLogContent()
 {
     if (file_exists(TestsHelpers::getUserLog())) {
         return file_get_contents(TestsHelpers::getUserLog());
     }
     return "";
 }
Пример #2
0
 protected function setUp()
 {
     $this->setupXmlObjects();
     $this->logger = LoggerFactory::getFileLogger(TestsHelpers::getUserLog(), Logger::WARNING);
     $this->bfObjectFiller = new BfObjectFiller($this->bfObject, $this->validators, $this->logger);
     TestsHelpers::cleanAllLogs();
 }
Пример #3
0
 public function testValidateUnknowProductTypeReturnsFalse()
 {
     $this->bfProduct->MasterProductId = "";
     $this->bfProduct->ProductId = "";
     $this->assertFalse($this->bfProductValidator->isComplete($this->bfProduct));
     $this->assertFileExists(TestsHelpers::getUserLog());
 }
 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());
 }
 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);
 }
 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());
 }
Пример #7
0
 public function testRemoveOrphans_DoesntRemoveAnything()
 {
     $productsFilter = new OkProductsFilter($this->okManufacturersArray, $this->logger);
     $productsWithoutOrphans = $productsFilter->removeOrphans($this->okProductsArray);
     $this->assertEquals(count($this->okProductsArray), count($productsWithoutOrphans));
     foreach ($this->okProductsArray as $key => $okProduct) {
         $this->assertEquals($okProduct->sku, $productsWithoutOrphans[$key]->sku);
     }
     $this->assertFileNotExists(TestsHelpers::getUserLog());
 }
Пример #8
0
 protected function setUp()
 {
     TestsHelpers::cleanAllLogs();
     $this->iniParams = TestsHelpers::getIniParams();
     $this->idPrefix = $this->iniParams->get("idPrefix");
     $this->bfVersion = $this->iniParams->get("bfVersion");
     $this->taxCategory = $this->iniParams->get("taxCategory");
     $this->viewAllowCategory = $this->iniParams->get("viewAllowCategory");
     $this->logger = LoggerFactory::getFileLogger(TestsHelpers::getUserLog(), Logger::WARNING);
     $this->xmlItemMapper = new ProductMapper($this->idPrefix, $this->bfVersion, $this->taxCategory, $this->viewAllowCategory, $this->logger);
 }
Пример #9
0
 protected function setUp()
 {
     TestsHelpers::cleanAllLogs();
     $iniParams = TestsHelpers::getIniParams();
     $this->idPrefix = $iniParams->get("idPrefix");
     $this->bfVersion = $iniParams->get("bfVersion");
     $this->logger = LoggerFactory::getFileLogger(TestsHelpers::getUserLog(), Logger::WARNING);
     $this->xmlItemMapper = new CategoryMapper($this->idPrefix, $this->bfVersion, $this->logger);
     $this->db = TestsHelpers::getDb();
     $this->okChannel = new OkChannel($iniParams->get("channelId"), $this->db);
 }
Пример #10
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);
 }
Пример #11
0
 protected function setUp()
 {
     TestsHelpers::cleanAllLogs();
     $iniParams = TestsHelpers::getIniParams();
     $this->idPrefix = $iniParams->get("idPrefix");
     $this->bfVersion = $iniParams->get("bfVersion");
     $this->orderShipCarrier = $iniParams->get("orderShipCarrier");
     $this->orderShipMethod = $iniParams->get("orderShipMethod");
     $this->logger = LoggerFactory::getFileLogger(TestsHelpers::getUserLog(), Logger::WARNING);
     $this->xmlItemMapper = new OrderStatusMapper($this->bfVersion, $this->orderShipCarrier, $this->orderShipMethod, $this->logger);
     $this->db = TestsHelpers::getDb();
     $this->okChannel = new OkChannel($iniParams->get("channelId"), $this->db);
     // 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());
 }
Пример #12
0
 protected function setUp()
 {
     $this->db = TestsHelpers::getDb();
     //$this->db->setVerboseMode();
     $this->iniParams = TestsHelpers::getIniParams();
     $this->idPrefix = $this->iniParams->get("idPrefix");
     $this->okChannel = new OkChannel($this->iniParams->get("channelId"), $this->db);
     $this->logger = LoggerFactory::getFileLogger(TestsHelpers::getUserLog(), Logger::WARNING);
     TestsHelpers::cleanAllLogs();
     $csvFile = new CsvFile(__DIR__ . "/Data/okProducts.csv", "\t");
     $this->okProductsUpdatesArray = $csvFile->getAll();
     array_splice($this->okProductsUpdatesArray, 10);
     $this->xmlExporter = new ProductsUpdates($this->iniParams, $this->okProductsUpdatesArray, $this->logger);
     $this->fileName = __DIR__ . "/Data/Exports/ProductsUpdates.xml";
     if (file_exists($this->fileName)) {
         unlink($this->fileName);
     }
 }
Пример #13
0
 protected function setUp()
 {
     $this->db = TestsHelpers::getDb();
     $this->db->setVerboseMode();
     $this->iniParams = TestsHelpers::getIniParams();
     $this->bfVersion = $this->iniParams->get("bfVersion");
     $this->okChannel = new OkChannel($this->iniParams->get("channelId"), $this->db);
     $this->logger = LoggerFactory::getFileLogger(TestsHelpers::getUserLog(), Logger::WARNING);
     TestsHelpers::cleanAllLogs();
     $okOrdersStatusesDataProvider = new OkOrdersStatusDataProvider($this->db, $this->okChannel->getCustomersId());
     $this->okOrdersStatusesArray = $okOrdersStatusesDataProvider->getAll();
     $this->xmlExporter = new OrdersStatuses($this->iniParams, $this->okOrdersStatusesArray, $this->logger);
     $this->fileName = __DIR__ . "/Data/Exports/OrdersStatuses.xml";
     if (file_exists($this->fileName)) {
         unlink($this->fileName);
     }
     // 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 testValidateWithoutManufacturerIdReturnsFalse()
 {
     $this->bfManufacturer->ManufacturerId = "";
     $this->assertFalse($this->bfManufacturerValidator->isComplete($this->bfManufacturer));
     $this->assertFileExists(TestsHelpers::getUserLog());
 }
 public function testGetLogPath()
 {
     $xml2remote = new XmlToRemoteConnector($this->localFeedPath, $this->remoteFeedDir, $this->xmlExporter, $this->ftp, $this->logger);
     $this->assertEquals(TestsHelpers::getUserLog(), $xml2remote->getLogPath());
 }
Пример #16
0
 public function setup()
 {
     $this->logger = LoggerFactory::getFileLogger(TestsHelpers::getUserLog(), Logger::WARNING);
 }
Пример #17
0
 public function testGetLogPath()
 {
     $xml2local = new XmlToLocalConnector($this->localFeedPath, $this->xmlExporter, $this->logger);
     $this->assertEquals(TestsHelpers::getUserLog(), $xml2local->getLogPath());
 }
 public function testGetLogPath()
 {
     $xml2bdd = new LocalXmlToBddConnector($this->localFeedDir, $this->xmlImporter, $this->logger);
     $this->assertEquals(TestsHelpers::getUserLog(), $xml2bdd->getLogPath());
 }
Пример #19
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();
 }