I am developping a command line tool that use PHP Class. I made tests for my Classes with coverage.
Now I would like to tests my PHP Script which used in command line.
I found how to trigger command line with the following thread : How do I test a command-line program with PHPUnit?
I would like to know how can I cover lines executed in the command line script.
I tried to make test as like :
class CommandTest extends \PHPUnit_Framework_TestCase
{
protected static $command = './src/Command.php ';
protected static $testWorkingDir = 'tests/Command';
public function testCLIInstall()
{
$command = self::$command . ' --help';
$output = `$command`;
}
}
The execution done successfully but nothing is cover in file 'Command.php'.
First, Is it possible ? Then, if it is, how can I do for cover Command Line Script ?
Thanks a lot for all.
Best Regards,
Neoblaster.
Update : I open an issue on GitHub : https://github.com/sebastianbergmann/phpunit/issues/2817