From 6daef4326ca14ab8be350bbb5d68ca25b65a8f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Babi=C4=8D?= Date: Wed, 16 Mar 2016 16:14:12 +0100 Subject: [PATCH] Refactor Table.isValidFortile to couldContainTile --- .idea/workspace.xml | 102 +++++++++++++++++++++++++++---------------- src/Coffee/Table.php | 7 ++- tests/TableTest.php | 4 +- 3 files changed, 72 insertions(+), 41 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ed0f4e0..d09b54e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,13 +1,10 @@ - - + - - @@ -36,18 +33,18 @@ - - + + - + - - + + @@ -63,10 +60,10 @@ - + - + @@ -126,10 +123,10 @@ @@ -363,10 +360,26 @@ - + + + + + + + + + + + + + + + + + @@ -450,13 +463,16 @@ - - - @@ -484,6 +500,9 @@ + + + @@ -491,6 +510,7 @@ + @@ -501,7 +521,6 @@ - @@ -525,7 +544,8 @@ @@ -868,14 +888,6 @@ - - - - - - - - @@ -892,14 +904,6 @@ - - - - - - - - @@ -910,11 +914,35 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Coffee/Table.php b/src/Coffee/Table.php index e509178..009e2b4 100644 --- a/src/Coffee/Table.php +++ b/src/Coffee/Table.php @@ -53,8 +53,11 @@ class Table { // foreach ($this->remainingPositions as $rowIndex => $tableRow) { // foreach ($tableRow as $columnIndex => $containsCoffee) { -// if ($containsCoffee) +// if ($containsCoffee) { // $tile = new Tile($columnIndex, $rowIndex); +// $spot = new Spot(); +// } +// // } // } } @@ -110,7 +113,7 @@ class Table { * @param Tile $tile * @return bool */ - public function isValidForTile(Tile $tile) { + public function couldContainTile(Tile $tile) { if ($tile->getColumn() < 0 || $tile->getRow() < 0) { return false; } diff --git a/tests/TableTest.php b/tests/TableTest.php index d7fbca6..2171d35 100644 --- a/tests/TableTest.php +++ b/tests/TableTest.php @@ -51,7 +51,7 @@ class TableTest extends \PHPUnit_Framework_TestCase { $table = new Table($tableMap); $tile = new Tile(0, 0); - $this->assertTrue($table->isValidForTile($tile)); + $this->assertTrue($table->couldContainTile($tile)); } public function testTileLiesOutsideTable() { @@ -62,7 +62,7 @@ class TableTest extends \PHPUnit_Framework_TestCase { $table = new Table($tableMap); $tile = new Tile(2, 1); - $this->assertFalse($table->isValidForTile($tile)); + $this->assertFalse($table->couldContainTile($tile)); } public function testGetSpots() {