/**
     * No SetUp No FEN --> OK
     * @covers pgn\Game::parse
     */
    public function test_parseSetUpAndFEN5()
    {
        $unparsedGame = <<<EOD
[Event "Brancas Jogam"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "Geraldo"]
[Black "Rybka 2.2 64 bit"]
[Result "*"]
[WhiteElo "2400"]
[BlackElo "2400"]
[Time "00:12:55"]
[TimeControl "60"]

*

EOD;
        $this->object->parse($unparsedGame);
    }
Exemple #2
0
 /**
  * Loads games from a PGN string
  * @param string $str PGN string
  * @throws InvalidGameFormatException throws an exception if the parameter
  *         is not a string or if it doesn't have the correct fields, i.e.
  *         the move text and the seven roster tags
  */
 public function load($str)
 {
     $pattern = "[\\s+" . Result::validPattern() . "]";
     $arr = preg_split($pattern, $str);
     foreach ($arr as $value) {
         $game = trim($value);
         if (!empty($game)) {
             $game = new Game();
             $game->parse(trim($value));
             $this->games[] = $game;
         }
     }
 }