Ejemplo n.º 1
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);
 }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
0
 private function addManufacturers()
 {
     $manufacturerMapper = new ManufacturerMapper($this->idPrefix, $this->bfVersion, $this->logger);
     foreach ($this->okManufacturersArray as $okManufacturer) {
         try {
             $bfManufacturer = $manufacturerMapper->map($okManufacturer);
             $this->xmlDocument->addNodeToParent($bfManufacturer, "ProductManufacturer");
         } catch (XmlItemMapperException $e) {
             ExceptionsHandler::logError($e, $this->logger);
             $this->logger->error(Debug::sprintf("Skipping following manufacturer : <%s>", $okManufacturer));
         }
     }
 }
Ejemplo n.º 4
0
 public function activate()
 {
     $this->userLogger->info("Generating Xml file : <" . $this->localFeedPath . ">");
     try {
         if (!is_dir($this->localFeedDir)) {
             mkdir($this->localFeedDir, 0777, true);
         }
         $this->xmlExporter->generateXml($this->localFeedPath);
         return true;
     } catch (\Exception $e) {
         ExceptionsHandler::logError($e, $this->userLogger);
     }
 }
Ejemplo n.º 5
0
 private function addOrdersStatuses()
 {
     $ordersStatusesMapper = new OrderStatusMapper($this->bfVersion, $this->orderShipCarrier, $this->orderShipMethod, $this->logger);
     foreach ($this->okOrderStatusesArray as $okOrderStatus) {
         try {
             $bfOrderStatus = $ordersStatusesMapper->map($okOrderStatus);
             $this->xmlDocument->addNodeToParent($bfOrderStatus, "BigFishOrderStatusUpdateFeed");
             $this->hasOrdersStatuses = true;
         } catch (XmlItemMapperException $e) {
             ExceptionsHandler::logError($e, $this->logger);
             $this->logger->error(Debug::sprintf("Skipping following order status : <%s>", $okOrderStatus));
         }
     }
 }
Ejemplo n.º 6
0
 private function addProductsUpdates()
 {
     $productUpdatesMapper = new ProductUpdateMapper($this->idPrefix, $this->bfVersion, $this->taxCategory, $this->viewAllowCategory, $this->logger);
     foreach ($this->okProductsUpdatesArray as $okProductUpdate) {
         try {
             $bfProduct = $productUpdatesMapper->map($okProductUpdate);
             $this->xmlDocument->addNodeToParent($bfProduct, "Products");
             $this->hasProductsUpdates = true;
         } catch (XmlItemMapperException $e) {
             ExceptionsHandler::logError($e, $this->logger);
             $this->logger->error(Debug::sprintf("Skipping following product update : <%s>", $okProductUpdate));
         }
     }
 }
Ejemplo n.º 7
0
 private function processAllXmlFiles()
 {
     $filesProcessed = 0;
     $dirLister = new PhpDirectoryLister();
     $xmlFilesList = $dirLister->listXml($this->localFeedDir);
     foreach ($xmlFilesList as $xmlFile) {
         try {
             $this->userLogger->info("processing file <{$xmlFile}> in <" . $this->localFeedDir . ">");
             $this->processXmlFile($xmlFile);
             $filesProcessed++;
         } catch (\Exception $e) {
             ExceptionsHandler::logError($e, $this->userLogger);
         }
     }
     $this->userLogger->info(get_class($this) . " has processed {$filesProcessed} / " . count($xmlFilesList) . " files");
 }
Ejemplo n.º 8
0
 private function processAllLocalXmlFiles()
 {
     $filesProcessed = 0;
     $directoryLister = new PhpDirectoryLister();
     $filesToProcessArray = $directoryLister->listXml($this->localFeedDir);
     $this->userLogger->info("Importing and archiving " . count($filesToProcessArray) . " local files");
     foreach ($filesToProcessArray as $fileToProcess) {
         try {
             $this->userLogger->info("processing local file <{$fileToProcess}> in <" . $this->localFeedDir . ">");
             $this->processLocalXmlFile($fileToProcess);
             $filesProcessed++;
         } catch (\Exception $e) {
             ExceptionsHandler::logError($e, $this->userLogger);
         }
     }
     $this->userLogger->info(get_class($this) . " has processed {$filesProcessed} / " . count($filesToProcessArray) . " local files");
 }