/**
* @covers \Clinner\Command\Command::fromString
* @covers \Clinner\Command\Command::parse
*/
public function testStaticFromStringManyCommands()
{
$commandString = 'cat ~/test.html | tr -s " " | cut -d: -f2 | wc';
$commandsCount = 4;
$command = Command::fromString($commandString);
$this->assertInstanceOf('\\Clinner\\Command\\Command', $command);
// Test that the inverse function also works
$this->assertEquals($commandString, $command->toCommandString(true));
$count = 0;
while (null !== $command) {
$count++;
$command = $command->getPipedCommand();
}
$this->assertEquals($commandsCount, $count);
}