예제 #1
0
파일: RoverApp.php 프로젝트: petun/mars
 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);
     }
 }
예제 #2
0
파일: FactoryTest.php 프로젝트: petun/mars
 public function testArgsPositionFactory()
 {
     $this->setExpectedException('Rover\\Exceptions\\RoverFactoryException');
     \Rover\Factory\RoverPositionFactory::create('1 10');
 }