Ejemplo n.º 1
0
 private function _createInputObjects()
 {
     $this->_dispatcher = new RoverDispatcher();
     $platoStr = array_shift($this->_inputLines);
     $platoTopCoordinates = CoordinatesFactory::create($platoStr);
     $this->_dispatcher->setPlato(new Plato($platoTopCoordinates));
     for ($i = 0; $i < count($this->_inputLines); $i++) {
         if ($i % 2) {
             $this->_commandSequences[] = new CommandSequence($this->_inputLines[$i]);
         } else {
             $this->_roverPositions[] = RoverPositionFactory::create($this->_inputLines[$i]);
         }
     }
     foreach ($this->_commandSequences as $index => $commandSequence) {
         $this->_dispatcher->addRover($this->_roverPositions[$index], $commandSequence);
     }
 }
Ejemplo n.º 2
0
 public function testInvalidCoordCharFactory()
 {
     $this->setExpectedException('Rover\\Exceptions\\InvalidCoordinatesException');
     \Rover\Factory\CoordinatesFactory::create('1 a');
 }