$idx->local('cd ~/docs && git config user.email "*****@*****.**"'); // copy new phar & commit $idx->local('cp -f idephix.phar ~/docs'); $idx->local("cp -f .git/refs/heads/master ~/docs/version"); $idx->local('cd ~/docs && git status'); $idx->local('cd ~/docs && git add -A .'); $idx->local("cd ~/docs && git commit -m 'deploy phar version {$new_version}'"); $idx->local('cd ~/docs && git push -q origin gh-pages'); }; $createPhar = function () use($idx) { $idx->output->writeln('Creating phar...'); $idx->local('rm -rf /tmp/Idephix && mkdir -p /tmp/Idephix'); $idx->local("cp -R . /tmp/Idephix"); $idx->local("cd /tmp/Idephix && rm -rf vendor"); $idx->local("cd /tmp/Idephix && git checkout -- ."); $idx->local('cd /tmp/Idephix && composer install --prefer-source --no-dev -o'); $idx->local('bin/box build -c /tmp/Idephix/box.json '); $idx->output->writeln('Smoke testing...'); $out = $idx->local('php idephix.phar'); if (false === strpos($out, 'Idephix version')) { echo "Error!\n"; exit(-1); } $idx->output->writeln('All good!'); }; $idx->add('deployPhar', $deployPhar); $idx->add('createPhar', $createPhar); $idx->add('buildTravis', $buildTravis); $idx->add('build', $build); $idx->run();
/** * @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()); }