public function testTest()
 {
     $config = \Magento\ToolkitFramework\Config::getInstance();
     $config->loadConfig(__DIR__ . '/_files/small.xml');
     /** @var \Magento\TestFramework\Application $itfApplication */
     $itfApplication = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getBootstrap()->getApplication();
     $shell = $this->getMock('Magento\\Framework\\Shell', [], [], '', false);
     $application = new \Magento\ToolkitFramework\Application($itfApplication->getTempDir(), $shell, $itfApplication->getInitParams());
     $application->bootstrap();
     foreach ($application->loadFixtures()->getFixtures() as $fixture) {
         $fixture->execute();
     }
 }
Beispiel #2
0
        exit(0);
    }
    $config = \Magento\ToolkitFramework\Config::getInstance();
    $config->loadConfig(\Magento\ToolkitFramework\Helper\Cli::getOption('profile'));
    $config->loadLabels(__DIR__ . '/framework/labels.xml');
    $labels = $config->getLabels();
    echo 'Generating profile with following params:' . PHP_EOL;
    foreach ($labels as $configKey => $label) {
        echo ' |- ' . $label . ': ' . $config->getValue($configKey) . PHP_EOL;
    }
    $files = \Magento\ToolkitFramework\FixtureSet::getInstance()->getFixtures();
    $logWriter = new \Zend_Log_Writer_Stream('php://output');
    $logWriter->setFormatter(new \Zend_Log_Formatter_Simple('%message%' . PHP_EOL));
    $logger = new \Zend_Log($logWriter);
    $shell = new \Magento\Framework\Shell(new \Magento\Framework\Shell\CommandRenderer(), $logger);
    $application = new \Magento\ToolkitFramework\Application($applicationBaseDir, $shell);
    $application->bootstrap();
    foreach ($files as $fixture) {
        echo $fixture['action'] . '... ';
        $startTime = microtime(true);
        $application->applyFixture(__DIR__ . '/fixtures/' . $fixture['file']);
        $endTime = microtime(true);
        $resultTime = $endTime - $startTime;
        echo ' done in ' . gmdate('H:i:s', $resultTime) . PHP_EOL;
    }
    $application->reindex();
    $totalEndTime = microtime(true);
    $totalResultTime = $totalEndTime - $totalStartTime;
    echo 'Total execution time: ' . gmdate('H:i:s', $totalResultTime) . PHP_EOL;
} catch (\Zend_Console_Getopt_Exception $e) {
    fwrite(STDERR, $e->getMessage() . "\n\n" . $e->getUsageMessage() . "\n");
Beispiel #3
0
 */
$applicationBaseDir = (require_once __DIR__ . '/framework/bootstrap.php');
try {
    $totalStartTime = microtime(true);
    $shell = new Zend_Console_Getopt(['profile-s' => 'Profile configuration file']);
    \Magento\ToolkitFramework\Helper\Cli::setOpt($shell);
    $args = $shell->getOptions();
    if (empty($args)) {
        echo $shell->getUsageMessage();
        exit(0);
    }
    $logWriter = new \Zend_Log_Writer_Stream('php://output');
    $logWriter->setFormatter(new \Zend_Log_Formatter_Simple('%message%' . PHP_EOL));
    $logger = new \Zend_Log($logWriter);
    $shell = new \Magento\Framework\Shell(new \Magento\Framework\Shell\CommandRenderer(), $logger);
    $application = new \Magento\ToolkitFramework\Application($applicationBaseDir, $shell, []);
    $application->bootstrap();
    $application->loadFixtures();
    $config = \Magento\ToolkitFramework\Config::getInstance();
    $config->loadConfig(\Magento\ToolkitFramework\Helper\Cli::getOption('profile'));
    echo 'Generating profile with following params:' . PHP_EOL;
    foreach ($application->getParamLabels() as $configKey => $label) {
        echo ' |- ' . $label . ': ' . $config->getValue($configKey) . PHP_EOL;
    }
    /** @var $config \Magento\Indexer\Model\Config */
    $config = $application->getObjectManager()->get('Magento\\Indexer\\Model\\Config');
    $indexerListIds = $config->getIndexers();
    /** @var $indexerRegistry \Magento\Indexer\Model\IndexerRegistry */
    $indexerRegistry = $application->getObjectManager()->create('Magento\\Indexer\\Model\\IndexerRegistry');
    $indexersState = [];
    foreach ($indexerListIds as $key => $indexerId) {