Skip to content

Commit

Permalink
Support GetPlayerItems and fix it's tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicekiwi committed Oct 10, 2019
1 parent b1bdef5 commit e00e9b3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/item/GetPlayerItems.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Array
(
[numberOfBackpackSlots] => 50
[items] => NukaCode\Database\Collection Object
[items] => Illuminate\Support\Collection Object
(
[items:protected] => Array
(
Expand Down
2 changes: 1 addition & 1 deletion src/Syntax/SteamApi/Steam/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function GetPlayerItems($appId, $steamId)
$items = $this->convertToObjects($client->result->items);

// Return a full inventory
return (array) new Inventory($client->result->num_backpack_slots, $items);
return new Inventory($client->result->num_backpack_slots, $items);
}

protected function convertToObjects($items)
Expand Down
2 changes: 1 addition & 1 deletion tests/BaseTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class BaseTester extends TestCase {

protected $packageId = 32848;

protected $itemid = 440;
protected $itemAppId = 440;

protected $groupId = 103582791429521412;

Expand Down
8 changes: 4 additions & 4 deletions tests/ItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
class ItemTest extends BaseTester
{
/** @test */
public function it_gets_items_for_an_by_user_id()
public function it_gets_items_for_an_app_by_user_id()
{
$items = $this->steamClient->item()->GetPlayerItems($this->itemid, $this->id64);
$inventory = $this->steamClient->item()->GetPlayerItems($this->appId, $this->id64);

$this->assertCount(1, $items);
$this->assertCount(3, $inventory->items);

$item = $items->first();
$item = $inventory->items->first();

$this->checkItemProperties($item);
}
Expand Down

0 comments on commit e00e9b3

Please sign in to comment.