-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectTest.php
More file actions
68 lines (57 loc) · 2.06 KB
/
ProjectTest.php
File metadata and controls
68 lines (57 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
namespace Aternos\SpigotApi\Tests\Integration\Client;
use Aternos\SpigotApi\ApiException;
use Aternos\SpigotApi\Client\Category;
use Aternos\SpigotApi\Client\Project;
use Aternos\SpigotApi\Tests\TestCase;
class ProjectTest extends TestCase
{
protected ?Project $project = null;
/**
* @throws ApiException
*/
public function setUp(): void
{
parent::setUp();
// Spark by Luck
$this->project = $this->apiClient->getProject(57242);
}
public function testGetCategory(): void
{
$resourceCategory = $this->project->getData()->getCategory();
$this->assertEquals(15, $resourceCategory->getId());
$this->assertEquals("Tools and Utilities", $resourceCategory->getTitle());
$this->assertEquals("", $resourceCategory->getDescription());
$category = $this->project->getCategory();
$this->assertEquals(Category::SPIGOT_TOOLS_AND_UTILITIES, $category);
}
/**
* @throws ApiException
*/
public function testGetAuthor(): void
{
// Luck
$author = $this->project->getAuthor();
$this->assertNotNull($author);
$this->assertValidAuthor($author->getData());
$this->assertEquals(100356, $author->getData()->getId());
$this->assertEquals("Luck", $author->getData()->getUsername());
$this->assertGreaterThan(1, $author->getData()->getResourceCount());
$this->assertStringStartsWith("https://www.spigotmc.org/data/avatars", $author->getData()->getAvatar());
// 1759349337 -> Wed Oct 01 2025
$this->assertGreaterThanOrEqual(1759349337, $author->getData()->getLastActivity());
}
/**
* @throws ApiException
*/
public function testGetVersions(): void
{
$versions = $this->project->getVersions();
$this->assertNotNull($versions);
$this->assertNotEmpty($versions);
foreach ($versions as $version) {
$this->assertValidVersion($version);
$this->assertEquals($this->project->getId(), $version->getProjectId());
}
}
}