-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathUserStatsTest.php
72 lines (52 loc) · 2.29 KB
/
UserStatsTest.php
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
69
70
71
72
<?php
require_once('BaseTester.php');
/** @group UserStats */
class UserStatsTest extends BaseTester {
/** @test */
public function it_returns_null_when_there_are_no_achievements_for_a_game()
{
$achievements = $this->steamClient->userStats($this->id64)->GetPlayerAchievements(359320);
$this->assertNull($achievements);
}
/** @test */
public function it_gets_the_users_achievements_for_a_game()
{
$achievements = $this->steamClient->userStats(76561198022436617)->GetPlayerAchievements(252950);
$this->assertInstanceOf(\Syntax\SteamApi\Containers\Achievement::class, $achievements[0]);
$this->checkAchievementProperties($achievements[0]);
}
/** @test */
public function it_gets_the_global_achievement_percentage_for_a_game()
{
$achievements = $this->steamClient->userStats($this->id64)->GetGlobalAchievementPercentagesForApp($this->appId);
$this->assertGreaterThan(0, $achievements);
$attributes = ['name', 'percent'];
$this->assertObjectHasProperties($attributes, $achievements[0]);
}
/** @test */
public function it_gets_the_user_stats_for_a_game()
{
$stats = $this->steamClient->userStats(76_561_198_159_417_876)->GetUserStatsForGame($this->appId);
$this->assertTrue(is_array($stats));
$attributes = ['name', 'achieved'];
$this->assertObjectHasProperties($attributes, $stats[0]);
}
/** @test */
public function it_gets_all_the_user_stats_for_a_game()
{
$stats = $this->steamClient->userStats(76_561_198_159_417_876)->GetUserStatsForGame($this->appId, true);
$this->assertTrue(is_object($stats));
$attributes = ['name', 'achieved'];
$this->assertObjectHasProperties($attributes, $stats->achievements[0]);
$attributes = ['name', 'value'];
$this->assertObjectHasProperties($attributes, $stats->stats[0]);
}
/** @test */
public function it_gets_all_the_stats_for_a_game()
{
$stats = $this->steamClient->userStats(76_561_198_159_417_876)->GetSchemaForGame($this->appId);
$this->assertTrue(is_object($stats));
$attributes = ['gameName', 'gameVersion', 'availableGameStats'];
$this->assertObjectHasProperties($attributes, $stats->game);
}
}