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();
 }
 protected function setUp()
 {
     $this->logger = LoggerFactory::getFileLogger(TestsHelpers::getUserLog(), Logger::WARNING);
     $this->bfManufacturerValidator = new BfManufacturerValidator($this->logger);
     $iniParams = TestsHelpers::getIniParams();
     $this->bfManufacturer = BfObjectFactory::getInstance("BfManufacturer", $iniParams->get("bfVersion"));
     TestsHelpers::cleanAllLogs();
 }
Example #3
0
 protected function setUp()
 {
     $this->db = TestsHelpers::getDb();
     $this->db->setVerboseMode();
     $this->systemLogger = LoggerFactory::getFileLogger(TestsHelpers::getSystemLog(), Logger::INFO);
     TestsHelpers::cleanAllLogs();
     $this->cleanTestRows();
 }
Example #4
0
 protected function setUp()
 {
     $this->logger = LoggerFactory::getFileLogger(TestsHelpers::getUserLog(), Logger::INFO);
     $this->db = TestsHelpers::getDb();
     $this->db->setVerboseMode();
     $this->tableRow = new TableRow(TableRowTest::TABLE_NAME, $this->db, $this->logger);
     $this->deleteTestInserts();
 }
Example #5
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;
 }
 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()
 {
     TestsHelpers::cleanAllLogs();
     $this->localFeedPath = E7_PATH . "/tests/E7/ConnectorsSets/Data/localFeeds/products/file1.xml";
     $this->localFeedDir = dirname($this->localFeedPath);
     $this->xmlExporter = m::mock('E7\\ConnectorsSets\\XmlExporter')->shouldReceive(array("generateXml" => true))->mock();
     $this->logFile = TestsHelpers::getUserLog();
     $this->logger = LoggerFactory::getFileLogger($this->logFile, Logger::INFO);
 }
 protected function setUp()
 {
     TestsHelpers::cleanAllLogs();
     $this->localFeedDir = __DIR__ . "/Data/localFeeds/orders";
     $this->ftp = TestsHelpers::getFtpConnection();
     $this->xmlImporter = m::mock('E7\\ConnectorsSets\\XmlImporter')->shouldReceive(array("import" => true))->mock();
     $this->logFile = TestsHelpers::getUserLog();
     $this->logger = LoggerFactory::getFileLogger($this->logFile, Logger::INFO);
     $this->testFiles = array("orders_20130101_123000.xml", "orders_20140101_123000.xml", "orders_20150101_123000.xml");
 }
Example #9
0
function testDecimal()
{
    $decimal = new Decimal(LoggerFactory::getNullLogger());
    $decimal->set(5.6);
    if (!$decimal->isValid()) {
        echo "\nInvalid decimal separator !";
    } else {
        echo "\nValid decimal separator";
    }
    echo "\n";
}
Example #10
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);
 }
Example #11
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);
 }
Example #12
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);
 }
Example #13
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);
 }
 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());
 }
Example #15
0
 public function testGenerateXml()
 {
     $xmlExporter = new CategoriesSeed("/media/truecrypt1/projects/client/p/main/E7/ConnectorsSets/OkToBf/CategoryMapping/client.csv", LoggerFactory::getNullLogger());
     $xmlFile = __DIR__ . "/Data/Exports/categoriesSeeds.xml";
     $xmlExporter->generateXml($xmlFile);
     $this->assertFileExists($xmlFile);
     // retrieves XmlData
     $xmlDocument = new \DOMDocument();
     $xmlDocument->load($xmlFile);
     $xpath = new \DOMXpath($xmlDocument);
     $ProductCategoryNodes = $xpath->query("ProductCategory");
     $ProductCategoryArray = array();
     foreach ($ProductCategoryNodes as $productCategory) {
         $ProductCategoryArray[] = simplexml_import_dom($productCategory);
     }
     $ProductCategoryRollupNodes = $xpath->query("ProductCategoryRollup");
     $ProductCategoryRollupArray = array();
     foreach ($ProductCategoryRollupNodes as $productCategoryRollup) {
         $ProductCategoryRollupArray[] = simplexml_import_dom($productCategoryRollup);
     }
     $e7MegaMenuCategoryMemberNodes = $xpath->query("E7MegaMenuCategoryMember");
     $e7MegaMenuCategoryMemberArray = array();
     foreach ($e7MegaMenuCategoryMemberNodes as $e7MegaMenuCategoryMember) {
         $e7MegaMenuCategoryMemberArray[] = simplexml_import_dom($e7MegaMenuCategoryMember);
     }
     $rootCategories = array("BF_CATEGORY_ROOT", "ZDE_RESERV");
     // Root catalog categories
     // Check for appropriate amount of entities
     $this->assertEquals(count($ProductCategoryArray), count($ProductCategoryRollupArray));
     $numberOfLevelOneCat = 0;
     foreach ($ProductCategoryArray as $productCategory) {
         if (in_array($productCategory["primaryParentCategoryId"]->__toString(), $rootCategories)) {
             $numberOfLevelOneCat++;
         }
     }
     $this->assertEquals($numberOfLevelOneCat, count($e7MegaMenuCategoryMemberArray));
     // ProductCategory : check that no children comes after his parent
     $parents = $rootCategories;
     foreach ($ProductCategoryArray as $productCategory) {
         $this->assertContains($productCategory["primaryParentCategoryId"]->__toString(), $parents);
         $parents[] = $productCategory["productCategoryId"]->__toString();
     }
     // Check that no Category without sequence number made it into the Xml
     foreach ($ProductCategoryRollupArray as $productCategoryRollup) {
         $this->assertFalse(empty($productCategoryRollup["sequenceNum"]->__toString()));
     }
 }
 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);
     }
 }
Example #17
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());
 }
 protected function setUp()
 {
     $okManufacturer1 = new \stdClass();
     $okManufacturer1->manufacturers_id = "IDMANUF1";
     $okManufacturer2 = new \stdClass();
     $okManufacturer2->manufacturers_id = "IDMANUF2";
     $okManufacturer3 = new \stdClass();
     $okManufacturer3->manufacturers_id = "IDMANUF3";
     $this->okManufacturersArray = array($okManufacturer1, $okManufacturer2, $okManufacturer3);
     $okProduct1 = new \stdClass();
     $okProduct1->sku = "PROD1";
     $okProduct1->products_manufacturers_id = "IDMANUF1";
     $okProduct2 = new \stdClass();
     $okProduct2->sku = "PROD2";
     $okProduct2->products_manufacturers_id = "IDMANUF2";
     $okProduct3 = new \stdClass();
     $okProduct3->sku = "PROD3";
     $okProduct3->products_manufacturers_id = "IDMANUF3";
     $this->okProductsArray = array($okProduct1, $okProduct2, $okProduct3);
     $this->logger = LoggerFactory::getFileLogger(TestsHelpers::getUserLog(), Logger::WARNING);
     TestsHelpers::cleanAllLogs();
 }
 public function setup()
 {
     $this->logger = LoggerFactory::getFileLogger(TestsHelpers::getUserLog(), Logger::WARNING);
 }
 protected function setUp()
 {
     $systemLog = TestsHelpers::getSystemLog();
     $this->systemLogger = LoggerFactory::getFileLogger($systemLog, Logger::INFO);
     TestsHelpers::cleanAllLogs();
 }
 protected function setUp()
 {
     $this->iniParams = TestsHelpers::getIniParams();
     $this->systemLogger = LoggerFactory::getFileLogger(TestsHelpers::getSystemLog(), Logger::INFO);
 }
Example #22
0
use E7\Actors\Client\Objects\OkCategoryList;
use E7\Actors\Client\CategoryMapper\CsvCategoryMapper;
// =========== Variables ===========
// Pour limiter l'export aux catégories présentes dans un fichier flux CSV, indiquer ici son emplacement / URL
//$activeCatsCsvFilePath 	= "feeds/BfWork/client-2014-11-24_16-47.csv";
//$exportFilePath 		= __DIR__ . "/Export/ClientActiveCats.csv";
// Sinon, utiliser les variables ci-dessous
$activeCatsCsvFilePath = "";
$exportFilePath = __DIR__ . "/Export/ClientCatMapping.csv";
// =========== Setup context ===========
require 'bootstrap.php';
$argv = $GLOBALS["argv"];
$cliParams = new CliParams();
$cliParams->parse($argv);
$iniParams = new IniParams($cliParams->getConfigFilePath());
$logger = LoggerFactory::getNullLogger();
$db = new Db($iniParams->get("dbHostReadOnly"), $iniParams->get("dbNameReadOnly"), $iniParams->get("dbUserReadOnly"), $iniParams->get("dbPassReadOnly"), $logger);
// =========== Get active cat list from CSV ===========
$activeCatsIds = array();
if ($activeCatsCsvFilePath !== "") {
    $csvFile = new CsvFile($activeCatsCsvFilePath, "\t");
    $activeCatsIds = array();
    foreach ($csvFile->getAll() as $csvLine) {
        $activeCatsIds[] = $csvLine->categories_categories_id;
    }
    $activeCatsIds = array_unique($activeCatsIds);
}
// =========== Get and process categories, then create CSV ===========
$okCategoriesDataProvider = new OkCategoriesDataProvider($db, 1);
// 1 = français
$csvCatMapper = new CsvCategoryMapper($okCategoriesDataProvider, $activeCatsIds, $exportFilePath, "\t");
Example #23
0
 public static function getDb()
 {
     $iniParams = self::getIniParams();
     $logger = LoggerFactory::getNullLogger();
     return new Db($iniParams->get("dbHostFullAuth"), $iniParams->get("dbNameFullAuth"), $iniParams->get("dbUserFullAuth"), $iniParams->get("dbPassFullAuth"), $logger);
 }
Example #24
0
 private function getUserLogger()
 {
     $logFile = $this->getConnectorLogPath();
     $logDir = dirname($this->getConnectorLogPath());
     if (!is_dir($logDir)) {
         mkdir($logDir, 0777, true);
     }
     return LoggerFactory::getFileLogger($logFile, Logger::INFO);
 }