Skip to content

Commit 35b4ea7

Browse files
committed
Fixing travis conf. Added test for passing array of steam ids on service construct.
1 parent ee9b02a commit 35b4ea7

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ php:
55
- 5.4
66
- hhvm
77

8+
matrix:
9+
allow_failures:
10+
- php: hhvm
11+
fast_finish: true
12+
813
before_script:
914
- composer install
1015

src/Syntax/SteamApi/Client.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ public function get()
5757
return $this;
5858
}
5959

60+
public function getSteamId()
61+
{
62+
return $this->steamId;
63+
}
64+
6065
/**
6166
* @param string $arguments
6267
*
@@ -253,15 +258,15 @@ protected function getApiKey()
253258
private function convertSteamIdTo64()
254259
{
255260
if (is_array($this->steamId)) {
256-
$this->steamId = array_walk($this->steamId, function (&$id, $key) {
261+
array_walk($this->steamId, function (&$id, $key) {
257262
if (strpos($id, ':') !== false) {
258263
// Convert the id to all types and grab the 64 bit version
259-
return $this->convertToAll($this->steamId)[2];
264+
$id = $this->convertToAll($id)->id64;
260265
}
261266
});
262267
} elseif (strpos(':', $this->steamId) !== false) {
263268
// Convert the id to all types and grab the 64 bit version
264-
$this->steamId = $this->convertToAll($this->steamId)[2];
269+
$this->steamId = $this->convertToAll($this->steamId)->id64;
265270
}
266271
}
267272
}

src/Syntax/SteamApi/SteamId.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private function convertToID32()
7878
private function convertToID64()
7979
{
8080
$formatted = bcadd($this->rawValue, self::$id64Base, 0);
81-
$this->formatted->{self::$ID64} = $formatted;
81+
$this->formatted->{self::$ID64} = (int) $formatted;
8282
}
8383

8484
private function convertToID3()

tests/UserTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
/** @group User */
44
class UserTest extends BaseTester {
55

6+
/** @test */
7+
public function it_accepts_an_array_of_steam_ids()
8+
{
9+
$steamIds = [$this->id32, $this->altId64];
10+
11+
$userService = $this->steamClient->user($steamIds);
12+
13+
$this->assertCount(2, $userService->getSteamId());
14+
$this->assertEquals($this->id64, $userService->getSteamId()[0]);
15+
}
16+
617
/** @test */
718
public function it_gets_the_base_users_player_summary()
819
{

0 commit comments

Comments
 (0)