public function testRun() { $cfgfile = dirname(dirname(__DIR__)) . '/src/aimeos-settings.php'; $argv = array("jobs.php", "--config={$cfgfile}", "index/rebuild", "unittest"); ob_start(); $result = \Aimeos\Slim\Command\Jobs::run($argv); $output = ob_get_contents(); ob_end_clean(); $this->assertEquals("Executing the Aimeos jobs for \"unittest\"\n", $output); }
<?php /** * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 * @copyright Aimeos (aimeos.org), 2016 */ if (php_sapi_name() != 'cli') { exit('Setup can only be started via command line for security reasons'); } ini_set('display_errors', 1); date_default_timezone_set('UTC'); try { require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; \Aimeos\Slim\Command\Jobs::run($_SERVER['argv']); } catch (\Aimeos\Slim\Command\Exception $e) { echo $e->getMessage() . "\n"; echo \Aimeos\Slim\Command\Jobs::usage(); exit(1); } catch (\Throwable $t) { echo "\n\nCaught PHP error while processing setup"; echo "\n\nMessage:\n"; echo $t->getMessage(); echo "\n\nStack trace:\n"; echo $t->getTraceAsString(); echo "\n\n"; exit(1); } catch (\Exception $e) { echo "\n\nCaught exception while processing setup"; echo "\n\nMessage:\n"; echo $e->getMessage(); echo "\n\nStack trace:\n";