public function testRouteCommandWithOptionalArgument()
 {
     $mock = $this->getMockBuilder('stdClass')->setMethods(['__invoke'])->getMock();
     $mock->expects($this->at(0))->method('__invoke')->with($this->callback(function (Input $input) {
         return $input->getAppName() === 'app' && $input->getArgument('exercise') === 'some-exercise';
     }))->will($this->returnValue(true));
     $mock->expects($this->at(1))->method('__invoke')->with($this->callback(function (Input $input) {
         return $input->getAppName() === 'app' && $input->getArgument('exercise') === 'some-exercise' && $input->getArgument('program') === 'program.php';
     }))->will($this->returnValue(true));
     $c = $this->createMock(ContainerInterface::class);
     $eventDispatcher = $this->createMock(EventDispatcher::class);
     $router = new CommandRouter([new CommandDefinition('verify', ['exercise', new CommandArgument('program', true), new CommandArgument('some-other-arg', true)], $mock)], 'verify', $eventDispatcher, $c);
     $router->route(['app', 'verify', 'some-exercise']);
     $router->route(['app', 'verify', 'some-exercise', 'program.php']);
     $router->route(['app', 'verify', 'some-exercise', 'program.php', 'some-other-arg-value']);
 }
 public function testRouteCommandSpeltIncorrectlyStillRoutes()
 {
     $mock = $this->getMock('stdClass', array('cb'));
     $mock->expects($this->once())->method('cb')->with('app', 'some-exercise', 'program.php')->will($this->returnValue(true));
     $c = $this->getMock(ContainerInterface::class);
     $router = new CommandRouter([new CommandDefinition('verify', ['exercise', 'program'], [$mock, 'cb'])], 'verify', $c);
     $router->route(['app', 'verifu', 'some-exercise', 'program.php']);
 }
 public function testRouteCommandSpeltIncorrectlyStillRoutes()
 {
     $mock = $this->getMockBuilder('stdClass')->setMethods(['__invoke'])->getMock();
     $mock->expects($this->once())->method('__invoke')->with('app', 'some-exercise', 'program.php')->will($this->returnValue(true));
     $c = $this->createMock(ContainerInterface::class);
     $router = new CommandRouter([new CommandDefinition('verify', ['exercise', 'program'], $mock)], 'verify', $c);
     $router->route(['app', 'verifu', 'some-exercise', 'program.php']);
 }