/**
  * @test
  */
 public function it_can_be_compared_with_another_id()
 {
     $anId = GameIdentifier::fromString('de305d54-75b4-431b-adb2-eb6b9e546014');
     $anotherId = GameIdentifier::fromString('de305d54-75b4-431b-adb2-eb6b9e546014');
     $yetAnotherId = GameIdentifier::fromString('00000000-0000-0000-0000-000000000000');
     $this->assertTrue($anId->equals($anId));
     $this->assertTrue($anId->equals($anotherId));
     $this->assertTrue($anotherId->equals($anId));
     $this->assertFalse($anId->equals($yetAnotherId));
     $this->assertFalse($yetAnotherId->equals($anotherId));
 }
예제 #2
0
 private function field()
 {
     $identifier = GameIdentifier::fromString($this->id());
     $game = $this->repository()->get($identifier);
     $this->repository()->save($game);
     $gameString = (string) $game;
     $gameString = str_replace(['=', 'v', '^', '<', '>', 'ǁ'], ' ', $gameString);
     return 'FIELD ' . PHP_EOL . $gameString . PHP_EOL;
     // . PHP_EOL . $game;
 }
예제 #3
0
 /**
  * Recreates a game from an array.
  *
  * @param array $data
  *
  * @return static
  */
 public static function fromArray(array $data)
 {
     $fireResults = [];
     foreach ($data['fireResults'] as $fireResult) {
         $fireResults[] = FireResult::fromArray($fireResult);
     }
     return new static(GameIdentifier::fromString($data['id']), Grid::fromArray($data['grid']), Score::create($fireResults), $fireResults, $data['locked']);
 }