Exemplo n.º 1
0
 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();
     }
 }
Exemplo n.º 2
0
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) {
        $indexer = $indexerRegistry->get($indexerId['indexer_id']);
        $indexersState[$indexerId['indexer_id']] = $indexer->isScheduled();