コード例 #1
0
ファイル: InMemoryArchive.php プロジェクト: rdfisher/connect4
 /**
  * @param Board $board
  * @param string $redPlayerName
  * @param string $yellowPlayerName
  * @param DateTime $date
  * @return integer
  */
 public function archive(Board $board, $redPlayerName = '', $yellowPlayerName = '', DateTime $date = null)
 {
     $archivedGame = new ArchivedGame($board, $redPlayerName, $yellowPlayerName, $date);
     $this->archive[] = $archivedGame;
     $id = count($this->archive);
     $archivedGame->setId($id);
     return $id;
 }
コード例 #2
0
 function it_can_archive_a_game(Board $board, DateTime $date)
 {
     $id = $this->archive($board, 'Jim', 'Bob', $date);
     $id->shouldBe(1);
     $archivedGame = new ArchivedGame($board->getWrappedObject(), 'Jim', 'Bob', $date->getWrappedObject());
     $archivedGame->setId(1);
     $this->getArchive()->shouldBeLike([$archivedGame]);
     $this->getById(1)->shouldBeLike($archivedGame);
 }