/** * @test */ public function shouldStoreGameInCache() { // given $chessFS = new ChessFS("pgn/chessfs.pgn"); // when $chessFS->getGame(1); $filePath = "chessfs_pgn_1.chess.cache"; // then $this->assertFileExists(ChessRegistry::getCacheFolder() . $filePath); }
public function __construct($pgnFile = null) { if (isset($pgnFile)) { $this->pgnFile = $this->getPgnPath($pgnFile); if (!$this->isValid($this->pgnFile)) { throw new Exception("Invalid file"); } if (!$this->pgnFile || !file_exists($this->pgnFile)) { throw new Exception("Pgn file " . $this->pgnFile . " not found"); } $this->cacheFolder = ChessRegistry::getCacheFolder(); } }