Completed
Push — Laravel4 ( 02d48b...8c5149 )
by Travis
03:47 queued 03:02
created

UserStatsTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 4
c 2
b 1
f 1
lcom 1
cbo 2
dl 0
loc 48
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A it_gets_the_users_achievements_for_a_game() 0 7 1
A it_gets_the_global_achievement_percentage_for_a_game() 0 9 1
A it_gets_the_user_stats_for_a_game() 0 9 1
A it_gets_all_the_user_stats_for_a_game() 0 12 1
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