/** * @dataProvider getTaskAndReturnCode */ public function testReturnCode($task, $expected) { $_SERVER['argv'] = array('idx', $task); $output = fopen("php://memory", 'r+'); $idx = new Idephix(array(), new SSH\SshClient(new SSH\FakeSsh2Proxy($this)), new StreamOutput($output)); $idx->getApplication()->setAutoExit(false); $idx->add('fooOk', function () use($idx) { $idx->local("echo 'God save the Queen'"); }); $idx->add('fooKo', function () use($idx) { $idx->local("God save the Queen but this command will fail!"); }); $this->assertEquals($expected, $idx->run()); }