From 8ad627967062ea0ad11a6daf95b5a9b3279773f0 Mon Sep 17 00:00:00 2001 From: Benjamin Morel Date: Wed, 26 Nov 2014 17:16:12 +0100 Subject: [PATCH] Added setCondition() to Search and Lookup --- lib/ApaiIO/Operations/Lookup.php | 16 ++++++++++++++++ lib/ApaiIO/Operations/Search.php | 16 ++++++++++++++++ .../ApaiIO/Test/Operations/Types/LookupTest.php | 7 +++++++ .../ApaiIO/Test/Operations/Types/SearchTest.php | 7 +++++++ 4 files changed, 46 insertions(+) diff --git a/lib/ApaiIO/Operations/Lookup.php b/lib/ApaiIO/Operations/Lookup.php index 670b397..3501c25 100644 --- a/lib/ApaiIO/Operations/Lookup.php +++ b/lib/ApaiIO/Operations/Lookup.php @@ -100,4 +100,20 @@ public function setSearchIndex($searchIndex) return $this; } + + /** + * Sets the condition of the items to return: New | Used | Collectible | Refurbished | All + * + * Defaults to New. + * + * @param string $condition + * + * @return \ApaiIO\Operations\Lookup + */ + public function setCondition($condition) + { + $this->parameter['Condition'] = $condition; + + return $this; + } } diff --git a/lib/ApaiIO/Operations/Search.php b/lib/ApaiIO/Operations/Search.php index c01cc41..2e20fc5 100644 --- a/lib/ApaiIO/Operations/Search.php +++ b/lib/ApaiIO/Operations/Search.php @@ -119,6 +119,22 @@ public function setMaximumPrice($price) return $this; } + /** + * Sets the condition of the items to return: New | Used | Collectible | Refurbished | All + * + * Defaults to New. + * + * @param string $condition + * + * @return \ApaiIO\Operations\Search + */ + public function setCondition($condition) + { + $this->parameter['Condition'] = $condition; + + return $this; + } + /** * Validates the given price. * diff --git a/tests/ApaiIO/Test/Operations/Types/LookupTest.php b/tests/ApaiIO/Test/Operations/Types/LookupTest.php index ec0cf93..1241f77 100644 --- a/tests/ApaiIO/Test/Operations/Types/LookupTest.php +++ b/tests/ApaiIO/Test/Operations/Types/LookupTest.php @@ -70,4 +70,11 @@ public function testGetSearchIndex() $lookup->setSearchIndex('Appliances'); $this->assertEquals('Appliances', $lookup->getSearchIndex()); } + + public function testConditionGetterAndSetter() + { + $lookup = new Lookup(); + $lookup->setCondition('All'); + $this->assertEquals('All', $lookup->getCondition()); + } } diff --git a/tests/ApaiIO/Test/Operations/Types/SearchTest.php b/tests/ApaiIO/Test/Operations/Types/SearchTest.php index 2a49dd4..c1fcee0 100644 --- a/tests/ApaiIO/Test/Operations/Types/SearchTest.php +++ b/tests/ApaiIO/Test/Operations/Types/SearchTest.php @@ -75,4 +75,11 @@ public function testSearchValidPage() $this->assertEquals(1, $search->getItemPage()); } + + public function testConditionGetterAndSetter() + { + $search = new Search(); + $search->setCondition('All'); + $this->assertEquals('All', $search->getCondition()); + } }