Skip to content

Commit

Permalink
Move unit test to feature test as it requires a db connection
Browse files Browse the repository at this point in the history
  • Loading branch information
lanedirt committed Jan 8, 2025
1 parent cfea89e commit ca3b709
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
16 changes: 16 additions & 0 deletions tests/Feature/BuildQueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tests\Feature;

use Exception;
use OGame\Models\BuildingQueue;
use OGame\Models\Resources;
use OGame\Services\SettingsService;
use Tests\AccountTestCase;
Expand Down Expand Up @@ -280,4 +281,19 @@ public function testResearchingPreventsResearchLabUpgrading(): void
$response->assertStatus(200);
$this->assertObjectNotInQueue($response, 'research_lab', 'Research lab is in build queue but should not be added.');
}

/**
* Tests object building queue status.
*/
public function testIsBuildingObject(): void
{
// Add level 3 shipyard to building queue
$queue = new BuildingQueue();
$queue->planet_id = $this->planetService->getPlanetId();
$queue->object_id = 21;
$queue->object_level_target = 3;
$queue->save();

$this->assertTrue($this->planetService->isBuildingObject('shipyard', 3));
}
}
19 changes: 0 additions & 19 deletions tests/Unit/PlanetServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,23 +222,4 @@ public function testGetPlanetBuildingCount(): void
// Should only return valid buildings, ( ie metal_mine crystal_mine, solar_plant )
$this->assertEquals(150, $this->planetService->getBuildingCount());
}

/**
* Tests object building queue status.
*/
public function testIsBuildingObject(): void
{
$this->createAndSetPlanetModel([
'id' => 1,
]);

// Add level 3 shipyard to building queue
$queue = new BuildingQueue();
$queue->planet_id = $this->planetService->getPlanetId();
$queue->object_id = 21;
$queue->object_level_target = 3;
$queue->save();

$this->assertTrue($this->planetService->isBuildingObject('shipyard', 3));
}
}

0 comments on commit ca3b709

Please sign in to comment.