public function testRowIsEmpty()
 {
     $catalogRepositoryMock = $this->getMockBuilder('Repositories\\Magento\\CatalogRepository')->disableOriginalConstructor()->getMock();
     $productImporter = new ProductImporter($catalogRepositoryMock);
     $result = $productImporter->rowIsEmpty(array());
     $this->assertTrue($result);
     $result = $productImporter->rowIsEmpty(array(''));
     $this->assertTrue($result);
     $result = $productImporter->rowIsEmpty(null);
     $this->assertTrue($result);
     $result = $productImporter->rowIsEmpty(' ');
     $this->assertTrue($result);
     $result = $productImporter->rowIsEmpty(array('foo', 'bar'));
     $this->assertFalse($result);
 }
    $fileName = $app->request()->params('filename');
    $locker = new ProcessLocker($config['lock_file']);
    if (!$locker->isLocked()) {
        $splitter = new CsvSplitter(new CsvFile($fileName), $config['output_csv_path']);
        $splitter->split($config['split_size']);
        $command = $config['nohup_path'] . ' ' . $config['php_path'] . ' ' . __DIR__ . '/src/shell/csv_importer.php ' . $config['output_csv_path'] . '  > /dev/null 2>&1 &';
        $process = new Process($command, $config['proc_working_path']);
        $process->run();
    }
    $app->redirect('/csv_batch_process/index.php');
});
use Helpers\Magento\MageWrapper;
use Repositories\Magento\CatalogRepository;
use Repositories\Magento\EavCatalogProductRepository;
use Processors\Magento\ProductImporter;
$app->get('/test/', function () use($app, $config) {
    ini_set('max_execution_time', -1);
    Mage::app('admin', 'store', array('global_ban_use_cache' => true))->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
    $mageWrapper = new MageWrapper(Mage);
    $eavRepository = new EavCatalogProductRepository($mageWrapper);
    $catalogRepository = new CatalogRepository($mageWrapper, $eavRepository);
    $magentoProcessor = new ProductImporter($catalogRepository);
    $magentoProcessor->process(new CsvFile('sample.csv'), 'sample.csv');
});
$app->get('/test_splitter/', function () use($app, $config) {
    $splitter = new CsvSplitter(new CsvFile('sample.csv'), $config['output_csv_path']);
    $splitter->setCsvHandler(new CsvHandler());
    $splitter->setFileHandler(new Filesystem());
    $splitter->split(5);
});
$app->run();
<?php

require_once __DIR__ . '/../config/config.php';
require_once $config['magento_full_path'];
use Keboola\Csv\CsvFile;
use Helpers\Magento\AttributeManager;
use Repositories\Magento\CatalogRepository;
use Repositories\Magento\EavCatalogProductRepository;
use Processors\Magento\ProductImporter;
Mage::app('admin', 'store', array('global_ban_use_cache' => true))->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$catalog_repository = new CatalogRepository(Mage);
$attribute_repository = new EavCatalogProductRepository(Mage);
$attribute_manager = new AttributeManager($attribute_repository);
$magento_processor = new ProductImporter($catalog_repository, $attribute_manager);
$magento_processor->process(new CsvFile($argv[1]), basename($argv[1]));