/** * @expectedException \InvalidArgumentException */ function testWithCwdThrowsExceptionWhenDirectoryDoesNotExist() { Path::chdir('/foo', function () { }); }
function execute($tasks) { $this->prepareEnv(); $tasks = (array) $tasks; $start = microtime(true); foreach ($tasks as $taskName) { if (!($task = $this['tasks'][$taskName])) { throw new \InvalidArgumentException(sprintf('Task "%s" not found.', $taskName)); } $this['log']->info(sprintf('Running Task "%s"', $taskName)); if ($this->projectDirectory) { Path::chdir($this->projectDirectory, array($task, 'invoke')); } else { $task->invoke(); } } $this['log']->info(sprintf('Build finished in %f seconds', microtime(true) - $start)); }
function cd($path, $callback = null) { return Path::chdir($path, $callback); }