function it_throws_without_command() { $args = array('./run_single.php', '--task_name=testscript', '--timeout=10'); try { $result = $this->subject->parse($args); throw new FailureException("Expected exception not thrown"); } catch (\InvalidArgumentException $e) { // Expected } }
#! /usr/bin/env php <?php /** * Wrapper script to run a script only once at a time across multiple instances * * Invoke it: * run_single.php [--no-garbage--collect] --task_name=<task_name> --timeout=<timeout> -- <command> * * @author Matthias Gisder <*****@*****.**> * @copyright 2014 inGenerator Ltd * @licence BSD */ use Ingenerator\RunSingle\Factory; use Ingenerator\RunSingle\ArgumentParser; error_reporting(E_ALL | E_STRICT); if (is_file($autoload = getcwd() . '/vendor/autoload.php')) { require $autoload; } $runsingle = Factory::create(); $parser = new ArgumentParser(); $args = $parser->parse($argv); $runsingle->execute($args['task_name'], $args['command'], $args['timeout'], $args['automatic_garbage_collect']);