Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions tests/Integration/Client/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Aternos\ModrinthApi\Client\Options\Facets\FacetType;
use Aternos\ModrinthApi\Client\Options\ProjectSearchOptions;
use Aternos\ModrinthApi\Client\SearchProject;
use Aternos\ModrinthApi\Client\Tags\GameVersion;
use PHPUnit\Framework\TestCase;

class ClientTest extends TestCase
Expand Down Expand Up @@ -116,7 +117,8 @@ public function testSearchProjectsByType(): void
$this->assertFalse($projectList->hasPreviousPage());
}

public function testSearchProjectsByDownloadCount() {
public function testSearchProjectsByDownloadCount()
{
$options = new ProjectSearchOptions();
$options->setFacets(new FacetANDGroup([
new FacetORGroup([
Expand Down Expand Up @@ -381,14 +383,18 @@ public function testGetLoaders()

public function testGetGameVersions()
{
$items = $this->apiClient->getGameVersions();
$this->assertNotEmpty($items);
$gameVersions = $this->apiClient->getGameVersions();
$this->assertNotEmpty($gameVersions);

foreach ($items as $item) {
$this->assertNotNull($item);
foreach ($gameVersions as $gameVersion) {
$this->assertNotNull($gameVersion);
}

$projects = $items[0]->searchProjects();
$latestRelease = array_find($gameVersions, function (GameVersion $gameVersion) {
return $gameVersion->getData()->getVersionType() === "release";
});

$projects = $latestRelease->searchProjects();
$this->assertNotEmpty($projects);
foreach ($projects as $project) {
$this->assertNotNull($project);
Expand Down Expand Up @@ -430,4 +436,4 @@ public function testGetReportTypes()
$this->assertNotNull($item);
}
}
}
}