Пример #1
0
 /**
  * Test without output buffering
  *
  * @outputBuffering enabled
  */
 public function testCheckAnswerTask4()
 {
     $_GET['reader'] = 'Db\\Product';
     $_GET['writer'] = 'Html';
     $argv[1] = 'Db\\Product';
     $argv[2] = 'Html';
     ob_start();
     include 'web.php';
     $resultOutput = trim(ob_get_contents());
     ob_end_clean();
     $processor = new ReadWriteProcessor(ReaderFactory::create('Db\\Product', include 'config/database.php'), WriterFactory::create('Html'), function () {
     });
     ob_start();
     $processor->processing();
     $expectResult = trim(ob_get_contents());
     ob_end_clean();
     $this->assertEquals($expectResult, $resultOutput);
 }
Пример #2
0
<?php

use OpsWay\Migration\Logger\OutOfStockLogger;
use OpsWay\Migration\Processor\ReadWriteProcessor;
use OpsWay\Migration\Reader\ReaderFactory;
use OpsWay\Migration\Writer\WriterFactory;
$config = (include 'config.php');
if (defined('CLI_MODE') && CLI_MODE === false) {
    die('This can be run only on CLI mode.' . PHP_EOL);
}
echo "Start Time: " . date("d-m-Y H:i:s") . PHP_EOL;
try {
    $processor = new ReadWriteProcessor(ReaderFactory::create($config['reader'], $config['params']), WriterFactory::create($config['writer'], $config['params']), new OutOfStockLogger(true));
    //Processing
    $processor->processing();
} catch (\Exception $e) {
    echo "ERROR: " . $e->getMessage();
} finally {
    echo PHP_EOL;
}
echo "End Time: " . date("d-m-Y H:i:s") . PHP_EOL;