protected function _before() { $progressBar = test::double('Symfony\\Component\\Console\\Helper\\ProgressBar'); $nullOutput = new \Symfony\Component\Console\Output\NullOutput(); $progressIndicator = new \Robo\Common\ProgressIndicator($progressBar, $nullOutput); $this->svn = test::double('Robo\\Task\\Vcs\\SvnStack', ['executeCommand' => new \AspectMock\Proxy\Anything(), 'output' => $nullOutput, 'logger' => new \Psr\Log\NullLogger(), 'logger' => Robo::logger(), 'getConfig' => Robo::config(), 'progressIndicator' => $progressIndicator]); }
/** * Sets static configuration, then runs task without working dir, with working dir and again without. */ public function testWorkingDirectoryStaticConfiguration() { \Robo\Task\Remote\Ssh::configure('remoteDir', '/some-dir'); verify((new \Robo\Task\Remote\Ssh('remote.example.com', 'user'))->setConfig(Robo::config())->exec('echo test')->getCommand())->equals("ssh user@remote.example.com 'cd \"/some-dir\" && echo test'"); verify((new \Robo\Task\Remote\Ssh('remote.example.com', 'user'))->remoteDir('/other-dir')->exec('echo test')->getCommand())->equals("ssh user@remote.example.com 'cd \"/other-dir\" && echo test'"); verify((new \Robo\Task\Remote\Ssh('remote.example.com', 'user'))->setConfig(Robo::config())->exec('echo test')->getCommand())->equals("ssh user@remote.example.com 'cd \"/some-dir\" && echo test'"); \Robo\Task\Remote\Ssh::configure('remoteDir', null); verify((new \Robo\Task\Remote\Ssh('remote.example.com', 'user'))->exec('echo test')->getCommand())->equals("ssh user@remote.example.com 'echo test'"); }
public function testDifferentTasksCanHaveSameConfigKeys() { ConfigurationTestTaskA::configure('key', 'value-a'); ConfigurationTestTaskB::configure('key', 'value-b'); $taskA = new ConfigurationTestTaskA(); $taskA->setConfig(Robo::config()); verify($taskA->run())->equals('value-a'); $taskB = new ConfigurationTestTaskB(); $taskB->setConfig(Robo::config()); verify($taskB->run())->equals('value-b'); }
/** * @deprecated */ public static function configure($key, $value) { Robo::config()->set(static::getClassKey($key), $value); }
/** * Description * @param $options * @option delay Miliseconds delay * @return type */ public function tryProgress($options = ['delay' => 500]) { $delay = $options['delay']; $delayUntilProgressStart = \Robo\Robo::config()->get(\Robo\Config::PROGRESS_BAR_AUTO_DISPLAY_INTERVAL); $this->say("Progress bar will display after {$delayUntilProgressStart} seconds of activity."); $processList = range(1, 10); return $this->collectionBuilder()->taskForEach($processList)->iterationMessage('Processing {value}')->call(function ($value) use($delay) { // TaskForEach::call should only be used to do // non-Robo operations. To use Robo tasks in an // iterator, @see TaskForEach::withBuilder. usleep($delay * 1000); // delay units: msec, usleep units: usec })->run(); }