Skip to content

Commit 64d03ce

Browse files
authored
Merge pull request #88 from Teakowa/fix-package-method-error
Fix package method error
2 parents aa443d4 + 24014d6 commit 64d03ce

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/Syntax/SteamApi/Containers/Package.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,16 @@ public function __construct($package, $id)
2424
$this->header = $this->checkIssetField($package, 'header_image', 'none');
2525
$this->small_logo = $this->checkIssetField($package, 'small_logo', 'none');
2626
$this->page_image = $this->checkIssetField($package, 'page_image', 'none');
27-
$this->price = $this->formatPriceObject($package, 'price');
27+
$this->price = $this->checkIssetField($package, 'price', $this->getFakePriceObject());
2828
$this->platforms = $package->platforms;
2929
$this->controller = $package->controller;
3030
$this->release = $package->release_date;
3131
}
32+
33+
protected function getFakePriceObject()
34+
{
35+
$object = new \stdClass();
36+
$object->final = 'No price found';
37+
return $object;
38+
}
3239
}

tests/BaseTester.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class BaseTester extends TestCase {
1515

1616
protected $appId = 620;
1717

18-
protected $packageId = 76710;
18+
protected $packageId = 32848;
1919

2020
protected $groupId = 103582791429521412;
2121

@@ -148,15 +148,15 @@ private function checkNestedAppProperties($app)
148148
}
149149

150150
/**
151-
* @param $packahe
151+
* @param $package
152152
*/
153-
private function checkNestedPackageProperties($packahe)
153+
private function checkNestedPackageProperties($package)
154154
{
155155
$attributes = ['currency', 'initial', 'final', 'discount_percent', 'individual'];
156-
$this->assertObjectHasAttributes($attributes, $packahe->price);
156+
$this->assertObjectHasAttributes($attributes, $package->price);
157157

158158
$attributes = ['windows', 'mac', 'linux'];
159-
$this->assertObjectHasAttributes($attributes, $packahe->platforms);
159+
$this->assertObjectHasAttributes($attributes, $package->platforms);
160160
}
161161

162162
/**

0 commit comments

Comments
 (0)