Skip to content

Commit 88b775b

Browse files
Travis BlasingameTravis Blasingame
authored andcommitted
Adding unit tests for the changes
1 parent 11dd943 commit 88b775b

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "syntax/steam-api",
3-
"description": "A steam-api client for Laravel 4.",
3+
"description": "A steam-api client for Laravel 5.",
44
"license": "MIT",
55
"authors": [
66
{

tests/UserStatsTest.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,26 @@ public function it_gets_the_global_achievement_percentage_for_a_game()
2626
/** @test */
2727
public function it_gets_the_user_stats_for_a_game()
2828
{
29-
$stats = $this->steamClient->userStats($this->id64)->GetUserStatsForGame($this->appId);
29+
$stats = $this->steamClient->userStats(76561198159417876)->GetUserStatsForGame(730);
3030

3131
$this->assertTrue(is_array($stats));
3232

3333
$attributes = ['name', 'achieved'];
3434
$this->assertObjectHasAttributes($attributes, $stats[0]);
3535
}
3636

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+
3751
}

tests/UserTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ public function it_accepts_an_array_of_steam_ids()
1414
$this->assertEquals($this->id64, $userService->getSteamId()[0]);
1515
}
1616

17+
/** @test */
18+
public function it_returns_no_match_from_an_invalid_display_name()
19+
{
20+
$steamObject = $this->steamClient->user($this->id64)->ResolveVanityURL('stygiansabyssINVALID');
21+
22+
$this->assertEquals('No match', $steamObject);
23+
}
24+
25+
/** @test */
26+
public function it_gets_the_steam_id_from_a_display_name()
27+
{
28+
$steamObject = $this->steamClient->user($this->id64)->ResolveVanityURL('stygiansabyss');
29+
30+
$this->assertEquals($this->id64, $steamObject->id64);
31+
}
32+
1733
/** @test */
1834
public function it_gets_the_base_users_player_summary()
1935
{

0 commit comments

Comments
 (0)