Refactor Table constructor to accept arguments

master
Peter Babič 8 years ago
parent 42aad05241
commit 285fb1a27b
Signed by: peter.babic
GPG Key ID: 4BB075BC1884BA40
  1. 138
      .idea/workspace.xml
  2. 5
      index.php
  3. 35
      src/Coffee/Table.php
  4. 22
      tests/MapTest.php
  5. 50
      tests/TableTest.php

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="65f95bb6-3a86-4ed6-841e-441936291ad4" name="Default" comment="Implement Tile.getNeighbors">
<list default="true" id="65f95bb6-3a86-4ed6-841e-441936291ad4" name="Default" comment="Refactor Spot constructor to ac">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/index.php" afterPath="$PROJECT_DIR$/index.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/Coffee/Spot.php" afterPath="$PROJECT_DIR$/src/Coffee/Spot.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/tests/SpotTest.php" afterPath="$PROJECT_DIR$/tests/SpotTest.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/Coffee/Table.php" afterPath="$PROJECT_DIR$/src/Coffee/Table.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/tests/MapTest.php" afterPath="$PROJECT_DIR$/tests/MapTest.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/tests/TableTest.php" afterPath="$PROJECT_DIR$/tests/TableTest.php" />
</list>
<ignored path="coffeetable.iws" />
<ignored path=".idea/workspace.xml" />
@ -34,8 +35,8 @@
<file leaf-file-name="index.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/index.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-14.666667">
<caret line="22" column="38" selection-start-line="22" selection-start-column="38" selection-end-line="22" selection-end-column="38" />
<state vertical-scroll-proportion="-14.0">
<caret line="21" column="37" selection-start-line="21" selection-start-column="37" selection-end-line="21" selection-end-column="37" />
<folding />
</state>
</provider>
@ -44,18 +45,18 @@
<file leaf-file-name="Table.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Coffee/Table.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-18.0">
<caret line="32" column="9" selection-start-line="32" selection-start-column="9" selection-end-line="32" selection-end-column="9" />
<state vertical-scroll-proportion="-9.333333">
<caret line="29" column="0" selection-start-line="29" selection-start-column="0" selection-end-line="37" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="TableTest.php" pinned="false" current-in-tab="false">
<file leaf-file-name="TableTest.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/tests/TableTest.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-0.6666667">
<caret line="3" column="0" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
<state vertical-scroll-proportion="0.3802817">
<caret line="24" column="0" selection-start-line="24" selection-start-column="2" selection-end-line="27" selection-end-column="10" />
<folding />
</state>
</provider>
@ -64,7 +65,7 @@
<file leaf-file-name="Tile.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Coffee/Tile.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-32.296295">
<state vertical-scroll-proportion="-41.703705">
<caret line="124" column="55" selection-start-line="124" selection-start-column="55" selection-end-line="124" selection-end-column="55" />
<folding />
</state>
@ -74,7 +75,7 @@
<file leaf-file-name="TileTest.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/tests/TileTest.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-14.962963">
<state vertical-scroll-proportion="-32.37037">
<caret line="106" column="27" selection-start-line="106" selection-start-column="27" selection-end-line="106" selection-end-column="27" />
<folding />
</state>
@ -84,8 +85,8 @@
<file leaf-file-name="Map.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Coffee/Map.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="3.3333333">
<caret line="71" column="0" selection-start-line="71" selection-start-column="2" selection-end-line="84" selection-end-column="5" />
<state vertical-scroll-proportion="-22.37037">
<caret line="127" column="5" selection-start-line="127" selection-start-column="5" selection-end-line="127" selection-end-column="5" />
<folding />
</state>
</provider>
@ -94,18 +95,18 @@
<file leaf-file-name="MapTest.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/tests/MapTest.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-5.703704">
<caret line="51" column="2" selection-start-line="51" selection-start-column="2" selection-end-line="51" selection-end-column="2" />
<state vertical-scroll-proportion="-7.703704">
<caret line="44" column="0" selection-start-line="44" selection-start-column="0" selection-end-line="44" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Spot.php" pinned="false" current-in-tab="true">
<file leaf-file-name="Spot.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Coffee/Spot.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.48987854">
<caret line="56" column="0" selection-start-line="56" selection-start-column="0" selection-end-line="56" selection-end-column="0" />
<state vertical-scroll-proportion="-9.037037">
<caret line="33" column="0" selection-start-line="33" selection-start-column="0" selection-end-line="41" selection-end-column="9" />
<folding />
</state>
</provider>
@ -152,15 +153,16 @@
<option value="$PROJECT_DIR$/composer.json" />
<option value="$PROJECT_DIR$/.gitignore" />
<option value="/usr/share/nginx/html/coffeetable/tests/TableTest.php" />
<option value="$PROJECT_DIR$/src/Coffee/Table.php" />
<option value="$PROJECT_DIR$/tests/TableTest.php" />
<option value="$PROJECT_DIR$/src/Coffee/Map.php" />
<option value="$PROJECT_DIR$/tests/MapTest.php" />
<option value="$PROJECT_DIR$/tests/TileTest.php" />
<option value="$PROJECT_DIR$/src/Coffee/Tile.php" />
<option value="$PROJECT_DIR$/src/Coffee/Spot.php" />
<option value="$PROJECT_DIR$/index.php" />
<option value="$PROJECT_DIR$/tests/SpotTest.php" />
<option value="$PROJECT_DIR$/index.php" />
<option value="$PROJECT_DIR$/tests/MapTest.php" />
<option value="/usr/share/nginx/html/coffeetable/src/Coffee/Table.php" />
<option value="$PROJECT_DIR$/src/Coffee/Table.php" />
<option value="$PROJECT_DIR$/tests/TableTest.php" />
</list>
</option>
</component>
@ -396,7 +398,7 @@
<property name="options.splitter.main.proportions" value="0.3" />
<property name="options.splitter.details.proportions" value="0.2" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="SearchEverywhereHistoryKey" value="comm cha&#9;ACTION&#9;ChangesView.Commit&#10;comple&#9;ACTION&#9;CodeCompletionGroup&#10;complet&#9;ACTION&#9;CodeCompletionGroup&#10;sear&#9;ACTION&#9;SearchEverywhere&#10;breakpoint&#9;ACTION&#9;ToggleLineBreakpoint&#10;comm ch&#9;ACTION&#9;ChangesView.Commit&#10;smart&#9;ACTION&#9;SmartTypeCompletion&#10;para&#9;ACTION&#9;IntroduceParameter&#10;keyma&#9;ACTION&#9;ChangeKeymap&#10;commit&#9;ACTION&#9;Vcs.CheckCommitMessageSpelling&#10;commit &#9;ACTION&#9;Vcs.CheckCommitMessageSpelling&#10;phpunit&#9;null&#9;null&#10;exte&#9;ACTION&#9;EditorSelectWord&#10;composer&#9;ACTION&#9;ComposerGroup&#10;test&#9;ACTION&#9;RerunTests&#10;rer&#9;ACTION&#9;RerunTests&#10;tests&#9;ACTION&#9;RerunTests&#10;hpunit&#9;ACTION&#9;PhpUnitGenerateTestMethod&#10;phpuni&#9;ACTION&#9;PhpUnitNewTest&#10;rear&#9;ACTION&#9;RearrangeCode" />
<property name="SearchEverywhereHistoryKey" value="next hi&#9;ACTION&#9;GotoNextError&#10;next&#9;ACTION&#9;GotoNextError&#10;comm cha&#9;ACTION&#9;ChangesView.Commit&#10;comple&#9;ACTION&#9;CodeCompletionGroup&#10;complet&#9;ACTION&#9;CodeCompletionGroup&#10;sear&#9;ACTION&#9;SearchEverywhere&#10;breakpoint&#9;ACTION&#9;ToggleLineBreakpoint&#10;comm ch&#9;ACTION&#9;ChangesView.Commit&#10;smart&#9;ACTION&#9;SmartTypeCompletion&#10;para&#9;ACTION&#9;IntroduceParameter&#10;keyma&#9;ACTION&#9;ChangeKeymap&#10;commit&#9;ACTION&#9;Vcs.CheckCommitMessageSpelling&#10;commit &#9;ACTION&#9;Vcs.CheckCommitMessageSpelling&#10;phpunit&#9;null&#9;null&#10;exte&#9;ACTION&#9;EditorSelectWord&#10;composer&#9;ACTION&#9;ComposerGroup&#10;test&#9;ACTION&#9;RerunTests&#10;rer&#9;ACTION&#9;RerunTests&#10;tests&#9;ACTION&#9;RerunTests&#10;hpunit&#9;ACTION&#9;PhpUnitGenerateTestMethod&#10;phpuni&#9;ACTION&#9;PhpUnitNewTest&#10;rear&#9;ACTION&#9;RearrangeCode" />
<property name="settings.editor.selected.configurable" value="preferences.keymap" />
<property name="settings.editor.splitter.proportion" value="0.2" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
@ -542,38 +544,44 @@
<option name="project" value="LOCAL" />
<updated>1458201829369</updated>
</task>
<option name="localTasksCounter" value="8" />
<task id="LOCAL-00008" summary="Refactor Tile constructor to accept parameters&#10;">
<created>1458202504523</created>
<option name="number" value="00008" />
<option name="project" value="LOCAL" />
<updated>1458202504523</updated>
</task>
<option name="localTasksCounter" value="9" />
<servers />
</component>
<component name="TestHistory">
<history-entry file="Tests - 2016.03.16 at 23h 56m 31s.xml">
<history-entry file="Tests - 2016.03.17 at 09h 11m 56s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.17 at 08h 21m 08s.xml">
<history-entry file="Tests - 2016.03.17 at 09h 12m 12s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.17 at 08h 57m 00s.xml">
<history-entry file="Tests - 2016.03.17 at 09h 12m 39s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.17 at 08h 59m 18s.xml">
<history-entry file="Tests - 2016.03.17 at 09h 12m 51s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.17 at 09h 00m 05s.xml">
<history-entry file="Tests - 2016.03.17 at 09h 20m 26s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.17 at 09h 11m 39s.xml">
<history-entry file="Tests - 2016.03.17 at 09h 45m 27s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.17 at 09h 11m 56s.xml">
<history-entry file="Tests - 2016.03.17 at 09h 46m 35s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.17 at 09h 12m 12s.xml">
<history-entry file="Tests - 2016.03.17 at 09h 48m 35s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.17 at 09h 12m 39s.xml">
<history-entry file="Tests - 2016.03.17 at 09h 48m 41s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
<history-entry file="Tests - 2016.03.17 at 09h 12m 51s.xml">
<history-entry file="Tests - 2016.03.17 at 09h 49m 48s.xml">
<configuration name="Tests" configurationId="PHPUnitRunConfigurationType" />
</history-entry>
</component>
@ -585,7 +593,7 @@
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32917705" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32917705" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.31670824" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.40149626" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.19375" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
@ -644,7 +652,8 @@
<MESSAGE value="Split Table and Map to the separate classes for decoupling" />
<MESSAGE value="Introduce index.php and require autoload.php in tests" />
<MESSAGE value="Implement Tile.getNeighbors" />
<option name="LAST_COMMIT_MESSAGE" value="Implement Tile.getNeighbors" />
<MESSAGE value="Refactor Tile constructor to accept parameters&#10;" />
<option name="LAST_COMMIT_MESSAGE" value="Refactor Tile constructor to accept parameters&#10;" />
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
</component>
<component name="XDebuggerManager">
@ -665,13 +674,6 @@
</watches-manager>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/../coffeetable_/src/CoffeeTable/Spot.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="42" column="0" selection-start-line="42" selection-start-column="0" selection-end-line="43" selection-end-column="20" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Coffee/Spot.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
@ -981,58 +983,58 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tests/TableTest.php">
<entry file="file://$PROJECT_DIR$/src/Coffee/Map.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-0.6666667">
<caret line="3" column="0" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
<state vertical-scroll-proportion="-22.37037">
<caret line="127" column="5" selection-start-line="127" selection-start-column="5" selection-end-line="127" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tests/MapTest.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-5.703704">
<caret line="51" column="2" selection-start-line="51" selection-start-column="2" selection-end-line="51" selection-end-column="2" />
<state vertical-scroll-proportion="-7.703704">
<caret line="44" column="0" selection-start-line="44" selection-start-column="0" selection-end-line="44" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Coffee/Map.php">
<entry file="file://$PROJECT_DIR$/src/Coffee/Tile.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="3.3333333">
<caret line="71" column="0" selection-start-line="71" selection-start-column="2" selection-end-line="84" selection-end-column="5" />
<state vertical-scroll-proportion="-41.703705">
<caret line="124" column="55" selection-start-line="124" selection-start-column="55" selection-end-line="124" selection-end-column="55" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tests/TileTest.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-14.962963">
<state vertical-scroll-proportion="-32.37037">
<caret line="106" column="27" selection-start-line="106" selection-start-column="27" selection-end-line="106" selection-end-column="27" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Coffee/Tile.php">
<entry file="file://$PROJECT_DIR$/src/Coffee/Spot.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-32.296295">
<caret line="124" column="55" selection-start-line="124" selection-start-column="55" selection-end-line="124" selection-end-column="55" />
<state vertical-scroll-proportion="-9.037037">
<caret line="33" column="0" selection-start-line="33" selection-start-column="0" selection-end-line="41" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Coffee/Table.php">
<entry file="file:///usr/share/nginx/html/coffeetable/src/Coffee/Table.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-18.0">
<caret line="32" column="9" selection-start-line="32" selection-start-column="9" selection-end-line="32" selection-end-column="9" />
<state vertical-scroll-proportion="0.3319838">
<caret line="35" column="0" selection-start-line="35" selection-start-column="0" selection-end-line="35" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/index.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-14.666667">
<caret line="22" column="38" selection-start-line="22" selection-start-column="38" selection-end-line="22" selection-end-column="38" />
<state vertical-scroll-proportion="-14.0">
<caret line="21" column="37" selection-start-line="21" selection-start-column="37" selection-end-line="21" selection-end-column="37" />
<folding />
</state>
</provider>
@ -1045,10 +1047,18 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Coffee/Spot.php">
<entry file="file://$PROJECT_DIR$/src/Coffee/Table.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-9.333333">
<caret line="29" column="0" selection-start-line="29" selection-start-column="0" selection-end-line="37" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tests/TableTest.php">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.48987854">
<caret line="56" column="0" selection-start-line="56" selection-start-column="0" selection-end-line="56" selection-end-column="0" />
<state vertical-scroll-proportion="0.3802817">
<caret line="24" column="0" selection-start-line="24" selection-start-column="2" selection-end-line="27" selection-end-column="10" />
<folding />
</state>
</provider>

@ -19,13 +19,8 @@ try {
if ($containsCoffee == true) {
$tile = new Tile($mapColumnIndex, $mapRowIndex);
$spot = new Spot($tile);
// $spot->addTile($tile);
$table->addSpot($spot);
}
// echo 'R: ' . $mapRowIndex . ', C: ' . $mapColumnIndex . ' = ' . $containsCoffee . ', ';
// echo $map->removeFromDescription($mapRowIndex, $mapColumnIndex) ? 'DELETED' : 'not';
// echo "<br>\n";
}
}

@ -23,14 +23,20 @@ class Table {
/**
* Table constructor.
*
* @param Spot|Spot[] $spots
*/
public function __construct() {
public function __construct($spots = null) {
if ($spots instanceof Spot) {
$this->addSpot($spots);
}
if (is_array($spots)) {
foreach ($spots as $spot) {
$this->addSpot($spot);
}
}
// foreach ($this->remainingPositions as $rowIndex => $tableRow) {
// foreach ($tableRow as $columnIndex => $containsCoffee) {
// $this->processPosition($columnIndex, $rowIndex, $containsCoffee);
// }
// }
}
/**
@ -60,21 +66,4 @@ class Table {
return count($this->spots);
}
// /**
// * @param int $column
// * @param int $row
// * @param bool $positionContainsCoffee
// */
// public function processCoordinate($column, $row, $positionContainsCoffee) {
// if ($positionContainsCoffee) {
// $tile = new Tile($column, $row);
// if ($this->getSpotsCount() == 0) {
// $spot = new Spot();
// $spot->addTile($tile);
// }
// else {
// }
// }
// }
}

@ -42,27 +42,7 @@ class MapTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(4, $map->getWidth());
}
// public function testRemoveFromDescription() {
// $description = [
// [0, 1, 0, 1, 1],
// [1, 0, 1, 0, 1],
// [0, 0, 0, 1, 0],
// ];
//
//
// $map = new Map($description);
// $map->removeFromDescription(0, 3);
// $map->removeFromDescription(1, 4);
// $map->removeFromDescription(2, 2);
//
// $descriptionAfterRemove = [
// [0, 1, 0, 1],
// [1, 0, 1, 0],
// [0, 0, 1, 0],
// ];
//
// $this->assertEquals($descriptionAfterRemove, $map->describedByArray());
// }
// public function testTileLiesOnTable() {
// $tableMap = [

@ -8,63 +8,33 @@ require __DIR__ . '/../vendor/autoload.php';
class TableTest extends \PHPUnit_Framework_TestCase {
public function testGetSpots() {
$tableMap = [
[1, 0],
[0, 1],
];
// $tableMap = [
// [1, 0],
// [0, 1],
// ];
$tile = new Tile(0, 0);
$spot = new Spot();
$table = new Table($tableMap);
$table = new Table();
$spot->addTile($tile);
$table->addSpot($spot);
$this->assertEquals([$spot], $table->getSpots());
}
public function testSpotsCount() {
$tableMap = [
[1, 0],
[0, 1],
];
// $tableMap = [
// [1, 0],
// [0, 1],
// ];
$tile = new Tile(0, 0);
$spot = new Spot();
$table = new Table($tableMap);
$table = new Table();
$spot->addTile($tile);
$table->addSpot($spot);
$table->addSpot($spot);
$this->assertEquals(2, $table->getSpotsCount());
}
// public function testRemoveMapCoordinate() {
// $tableMap = [
// [1, 0],
// [0, 1],
// ];
//
// $table = new Table($tableMap);
// $table->processCoordinate(0, 0);
//
// $processedTableMap = [
// [0],
// [0, 1],
// ];
//
// $this->assertEquals($processedTableMap, $table->getRemainingPositions());
// }
// public function testConvertCoffeeTileToSpot() {
// $tableMap = [
// [1, 0],
// [0, 1],
// ];
//
// $tile = new Tile(0, 0);
// $spot = new Spot();
// $table = new Table($tableMap);
// $spot->addTile($tile);
// $table->addSpot($spot);
// $table->addSpot($spot);
// $this->assertEquals(2, $table->getSpotsCount());
// }
}

Loading…
Cancel
Save