From 33121c4a0ab00a9efef173093b1f98c187021552 Mon Sep 17 00:00:00 2001 From: Teakowa Date: Mon, 22 Apr 2019 21:01:33 +0800 Subject: [PATCH 1/2] fix: Containers/Package.php method error Remove `formatPriceObject` method in Containers/Package.php price, it should be the same as the Containers/App.php --- src/Syntax/SteamApi/Containers/Package.php | 9 ++++++++- tests/BaseTester.php | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Syntax/SteamApi/Containers/Package.php b/src/Syntax/SteamApi/Containers/Package.php index a993577..d208f57 100644 --- a/src/Syntax/SteamApi/Containers/Package.php +++ b/src/Syntax/SteamApi/Containers/Package.php @@ -24,9 +24,16 @@ public function __construct($package, $id) $this->header = $this->checkIssetField($package, 'header_image', 'none'); $this->small_logo = $this->checkIssetField($package, 'small_logo', 'none'); $this->page_image = $this->checkIssetField($package, 'page_image', 'none'); - $this->price = $this->formatPriceObject($package, 'price'); + $this->price = $this->checkIssetField($package, 'price', $this->getFakePriceObject()); $this->platforms = $package->platforms; $this->controller = $package->controller; $this->release = $package->release_date; } + + protected function getFakePriceObject() + { + $object = new \stdClass(); + $object->final = 'No price found'; + return $object; + } } diff --git a/tests/BaseTester.php b/tests/BaseTester.php index f1aeade..df2b2ae 100644 --- a/tests/BaseTester.php +++ b/tests/BaseTester.php @@ -15,7 +15,7 @@ class BaseTester extends TestCase { protected $appId = 620; - protected $packageId = 76710; + protected $packageId = 32848; protected $groupId = 103582791429521412; From 24014d630eb2f06aeecec932afd18caf0bb7503d Mon Sep 17 00:00:00 2001 From: Teakowa Date: Mon, 22 Apr 2019 21:07:06 +0800 Subject: [PATCH 2/2] fix spelling mistake Correct `packahe` to `package` in test/BaseTester.php --- tests/BaseTester.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/BaseTester.php b/tests/BaseTester.php index df2b2ae..b128662 100644 --- a/tests/BaseTester.php +++ b/tests/BaseTester.php @@ -148,15 +148,15 @@ private function checkNestedAppProperties($app) } /** - * @param $packahe + * @param $package */ - private function checkNestedPackageProperties($packahe) + private function checkNestedPackageProperties($package) { $attributes = ['currency', 'initial', 'final', 'discount_percent', 'individual']; - $this->assertObjectHasAttributes($attributes, $packahe->price); + $this->assertObjectHasAttributes($attributes, $package->price); $attributes = ['windows', 'mac', 'linux']; - $this->assertObjectHasAttributes($attributes, $packahe->platforms); + $this->assertObjectHasAttributes($attributes, $package->platforms); } /**