function testRunDoesNotNeedArgs() { Chain::add('test1', function () { return 1; }); $this->assertEquals([1], Chain::run('test1')->realize()); }
/** * @covers \Tivie\Command\Chain::add * @covers \Tivie\Command\Chain::run */ public function testRunPipedArgument() { $chain = new Chain(); $xArg = 'foo'; $result1 = $this->getResultMock($xArg, 0); $cmd1 = $this->getCmdMock(); $cmd1->expects($this->once())->method('run')->willReturn($result1); $chain->add($cmd1); $cmd2 = $this->getCmdMock(); $arg1 = $this->getArgumentMock('bar', array(PIPE_PH)); $arg1->expects($this->once())->method('replaceValue')->with(0, $xArg); $cmd2->addArgument($arg1); $chain->add($cmd2, RUN_IF_PREVIOUS_SUCCEEDS, true); $chain->run(); }
function __call($name, $args) { array_unshift($args, $this->data); return Chain::run($name, $args); }