1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** @group UserStats */ |
4
|
|
|
class UserStatsTest extends BaseTester { |
5
|
|
|
|
6
|
|
|
/** @test */ |
7
|
|
|
public function it_gets_the_users_achievements_for_a_game() |
8
|
|
|
{ |
9
|
|
|
$achievements = $this->steamClient->userStats($this->id64)->GetPlayerAchievements($this->appId); |
10
|
|
|
|
11
|
|
|
$this->assertInstanceOf('Syntax\SteamApi\Containers\Achievement', $achievements[0]); |
12
|
|
|
$this->checkAchievementProperties($achievements[0]); |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
/** @test */ |
16
|
|
|
public function it_gets_the_global_achievement_percentage_for_a_game() |
17
|
|
|
{ |
18
|
|
|
$achievements = $this->steamClient->userStats($this->id64)->GetGlobalAchievementPercentagesForApp($this->appId); |
19
|
|
|
|
20
|
|
|
$this->assertGreaterThan(0, $achievements); |
21
|
|
|
|
22
|
|
|
$attributes = ['name', 'percent']; |
23
|
|
|
$this->assertObjectHasAttributes($attributes, $achievements[0]); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** @test */ |
27
|
|
|
public function it_gets_the_user_stats_for_a_game() |
28
|
|
|
{ |
29
|
|
|
$stats = $this->steamClient->userStats(76561198159417876)->GetUserStatsForGame(730); |
30
|
|
|
|
31
|
|
|
$this->assertTrue(is_array($stats)); |
32
|
|
|
|
33
|
|
|
$attributes = ['name', 'achieved']; |
34
|
|
|
$this->assertObjectHasAttributes($attributes, $stats[0]); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** @test */ |
38
|
|
|
public function it_gets_all_the_user_stats_for_a_game() |
39
|
|
|
{ |
40
|
|
|
$stats = $this->steamClient->userStats(76561198159417876)->GetUserStatsForGame(730, true); |
41
|
|
|
|
42
|
|
|
$this->assertTrue(is_object($stats)); |
43
|
|
|
|
44
|
|
|
$attributes = ['name', 'achieved']; |
45
|
|
|
$this->assertObjectHasAttributes($attributes, $stats->achievements[0]); |
46
|
|
|
|
47
|
|
|
$attributes = ['name', 'value']; |
48
|
|
|
$this->assertObjectHasAttributes($attributes, $stats->stats[0]); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
} |
52
|
|
|
|