Index: tests/Zend/Service/Yahoo/OnlineTest.php =================================================================== --- tests/Zend/Service/Yahoo/OnlineTest.php (revision 12417) +++ tests/Zend/Service/Yahoo/OnlineTest.php (working copy) @@ -327,6 +327,24 @@ $this->assertContains('error occurred sending request', $e->getMessage()); } } + + /** + * Check support for the region option and ensure that it throws an exception + * for unsupported regions + * + * @group ZF-3222 + * @return void + */ + public function testWebSearchRegion() + { + $this->_yahoo->webSearch('php', array('region' => 'nl')); + try { + $this->_yahoo->webSearch('php', array('region' => 'oops')); + $this->fail('Expected Zend_Service_Exception not thrown'); + }catch (Zend_Service_Exception $e) { + $this->assertContains("Invalid value for option 'region': oops", $e->getMessage()); + } + } } Index: library/Zend/Service/Yahoo.php =================================================================== --- library/Zend/Service/Yahoo.php (revision 12417) +++ library/Zend/Service/Yahoo.php (working copy) @@ -400,6 +400,7 @@ * 'similar_ok' => bool permit similar results in the result set * 'country' => string The country code for the content searched * 'license' => (any|cc_any|cc_commercial|cc_modifiable) The license of content being searched + * 'region' => The regional search engine on which the service performs the search. default us. * * @param string $query the query being run * @param array $options any optional parameters @@ -803,7 +804,7 @@ protected function _validateWebSearch(array $options) { $validOptions = array('appid', 'query', 'results', 'start', 'language', 'type', 'format', 'adult_ok', - 'similar_ok', 'country', 'site', 'subscription', 'license'); + 'similar_ok', 'country', 'site', 'subscription', 'license', 'region'); $this->_compareOptions($options, $validOptions); @@ -838,6 +839,12 @@ 'txt', 'xls')); $this->_validateInArray('license', $options['license'], array('any', 'cc_any', 'cc_commercial', 'cc_modifiable')); + if (isset($options['region'])){ + $this->_validateInArray('region', $options['region'], array('ar', 'au', 'at', 'br', 'ca', 'ct', 'dk', 'fi', + 'fr', 'de', 'in', 'id', 'it', 'my', 'mx', + 'nl', 'no', 'ph', 'ru', 'sg', 'es', 'se', + 'ch', 'th', 'uk', 'us')); + } }