public function testHasPoint() { $point = new Point(6, 7); $pointCollection = new PointCollection([$point]); $this->assertTrue($pointCollection->hasPoint($point)); $this->asserttrue($pointCollection->hasPoint(new Point(6, 7))); $this->assertfalse($pointCollection->hasPoint(new Point(2, 2))); }
/** * Used to check if game should end * @return boolean */ public function isThereNonSunkBattleship() { foreach ($this->placers as $placer) { foreach ($placer->getPoints() as $placerPoint) { if (!$this->shots->hasPoint($placerPoint)) { return true; } } } return false; }