diff --git a/tests/acceptance.suite.yml b/tests/acceptance.suite.yml index 418aabb..018d5ee 100644 --- a/tests/acceptance.suite.yml +++ b/tests/acceptance.suite.yml @@ -9,7 +9,7 @@ modules: enabled: - PhpBrowser: url: http://localhost/myapp - - \Helper\Acceptance + #- \Helper\Acceptance step_decorators: ~ coverage: enabled: false \ No newline at end of file diff --git a/tests/acceptance/.gitkeep b/tests/acceptance/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/functional.suite.yml b/tests/functional.suite.yml index 303c8ac..642e04d 100644 --- a/tests/functional.suite.yml +++ b/tests/functional.suite.yml @@ -9,5 +9,5 @@ actor: FunctionalTester modules: enabled: # add a framework module here - - \Helper\Functional + #- \Helper\Functional step_decorators: ~ \ No newline at end of file diff --git a/tests/functional/.gitkeep b/tests/functional/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit.suite.yml b/tests/unit.suite.yml index 00565f6..ba40eec 100644 --- a/tests/unit.suite.yml +++ b/tests/unit.suite.yml @@ -6,5 +6,5 @@ actor: UnitTester modules: enabled: - Asserts - - \Helper\Unit + #- \Helper\Unit step_decorators: ~ \ No newline at end of file diff --git a/tests/unit/BaseUnit.php b/tests/unit/BaseUnit.php index 27d980d..92b95b4 100644 --- a/tests/unit/BaseUnit.php +++ b/tests/unit/BaseUnit.php @@ -3,8 +3,14 @@ namespace Tests\unit; use Codeception\Test\Unit; +use Azul\Game\Table; +use Azul\Tile\Marker; abstract class BaseUnit extends Unit { protected \UnitTester $tester; + + public function createGameTable(): \Azul\Game\Table { + return new Table(new Marker()); + } } \ No newline at end of file diff --git a/tests/unit/GameRoundTest.php b/tests/unit/GameRoundTest.php index a6d1abe..233d945 100644 --- a/tests/unit/GameRoundTest.php +++ b/tests/unit/GameRoundTest.php @@ -12,7 +12,7 @@ class GameRoundTest extends BaseUnit { public function testKeepPlaying_EmptyFactoriesAndTable_False(): void { - $t = $this->tester->createGameTable(); + $t = $this->createGameTable(); $round = new GameRound($t, [ $f = new Factory( diff --git a/tests/unit/PlayerTest.php b/tests/unit/PlayerTest.php index 5f634f2..bcfcc07 100644 --- a/tests/unit/PlayerTest.php +++ b/tests/unit/PlayerTest.php @@ -19,14 +19,14 @@ public function testGetNextMove_ReturnMoveObject(): void $player = new Player(new Board()); $factory = new Factory(new TileCollection([new Tile(Color::BLUE)])); $move = $player->getNextMove(new FactoryCollection([$factory]), - $this->tester->createGameTable()); + $this->createGameTable()); $this->assertNotNull($move); } public function testGetNextMove_TiledFactoryEmptyTable_TookTilesFromFactory(): void { $player = new Player(new Board()); - $t = $this->tester->createGameTable(); + $t = $this->createGameTable(); $factory = new Factory(new TileCollection([new Tile(Color::BLUE)])); $move = $player->getNextMove(new FactoryCollection([$factory]), $t); @@ -36,7 +36,7 @@ public function testGetNextMove_TiledFactoryEmptyTable_TookTilesFromFactory(): v public function testGetNextMove_EmptyFactoryTiledTable_TookTilesFromTable(): void { $player = new Player(new Board()); - $t = $this->tester->createGameTable(); + $t = $this->createGameTable(); $t->addToCenterPile(new TileCollection([new Tile(Color::BLUE)])); $move = $player->getNextMove(new FactoryCollection([new Factory(new TileCollection())]), @@ -52,7 +52,7 @@ public function testGetNextMove_AllWallRowsHasRedTile_TookTilesAnyway(): void $board->placeTiles(new TileCollection([new Tile(Color::RED)]), Board::ROW_3); $board->placeTiles(new TileCollection([new Tile(Color::RED)]), Board::ROW_4); $board->placeTiles(new TileCollection([new Tile(Color::RED)]), Board::ROW_5); - $t = $this->tester->createGameTable(null); + $t = $this->createGameTable(null); $t->addToCenterPile(new TileCollection([new Tile(Color::BLACK)])); $this->assertEquals(0, $board->getFloorTilesCount()); diff --git a/tests/unit/TableTest.php b/tests/unit/TableTest.php index 44700ff..24a72ab 100644 --- a/tests/unit/TableTest.php +++ b/tests/unit/TableTest.php @@ -11,7 +11,7 @@ class TableTest extends BaseUnit { public function testCountTotal_2DifferentColors_Total2(): void { - $table = $this->tester->createGameTable(); + $table = $this->createGameTable(); $table->addToCenterPile(new TileCollection([ new Tile(Color::RED), new Tile(Color::CYAN), @@ -21,7 +21,7 @@ public function testCountTotal_2DifferentColors_Total2(): void public function testCountTotal_2SameColors_Total2(): void { - $table = $this->tester->createGameTable(); + $table = $this->createGameTable(); $table->addToCenterPile(new TileCollection([ new Tile(Color::RED), new Tile(Color::RED), @@ -31,13 +31,13 @@ public function testCountTotal_2SameColors_Total2(): void public function testCountTotal_Empty_Total0(): void { - $table = $this->tester->createGameTable(); + $table = $this->createGameTable(); $this->assertEquals(0, $table->getTilesCount()); } public function testCountByColor(): void { - $table = $this->tester->createGameTable(); + $table = $this->createGameTable(); $table->addToCenterPile(new TileCollection([ new Tile(Color::RED), new Tile(Color::RED), @@ -54,7 +54,7 @@ public function testCountByColor(): void public function testTakeMarker_HasMarker_NoMarkerAfter(): void { - $table = $this->tester->createGameTable(); + $table = $this->createGameTable(); $this->assertTrue($table->hasMarker()); $marker = $table->takeMarker(); $this->assertNotNull($marker); @@ -63,7 +63,7 @@ public function testTakeMarker_HasMarker_NoMarkerAfter(): void public function testTakeMarker_Twice_GotException(): void { - $table = $this->tester->createGameTable(); + $table = $this->createGameTable(); $table->takeMarker(); $this->expectException(MarkerAlreadyTakenException::class); $table->takeMarker(); @@ -71,7 +71,7 @@ public function testTakeMarker_Twice_GotException(): void public function testTake_HasMarker_MarkerLeft(): void { - $table = $this->tester->createGameTable(); + $table = $this->createGameTable(); $color = Color::RED; $table->addToCenterPile(new TileCollection([ new Tile($color),