Parsing out clock %clk comments

This commit is contained in:
DHTMLGoodies
2017-01-30 13:42:28 +01:00
parent d17e42e7da
commit 5505a28b1d
5 changed files with 68 additions and 1 deletions

View File

@@ -2026,6 +2026,29 @@ Rc8 Ne6+ 72. Kf6 d2 73. c5+ Kd7 0-1';
// then
$this->assertEquals((36*2)+1, count($game['moves']));
}
/**
* @test
*/
public function shouldParseClockComments(){
// given
$pgnParser = new PgnParser("pgn/lcc2016.pgn");
// when
$game = $pgnParser->getGameByIndex(0);
// then
$this->assertNotEmpty($game['white'], $game);
$this->assertNotEmpty($game['moves'][0]);
$m = json_encode($game['moves'][0]);
echo $m;
$this->assertNotEmpty($game['moves'][0]['clock'], "Move: ". $m);
$this->assertEquals('1:59:56',$game['moves'][0]['clock']);
}
/**
* @test
*/