_amazon = new Zend_Service_Amazon(constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ACCESSKEYID')); $this->_httpClientAdapterTest = new Zend_Http_Client_Adapter_Test(); } /** * Ensures that __construct() throws an exception when given an invalid country code * * @return void */ public function testConstructExceptionCountryCodeInvalid() { try { $amazon = new Zend_Service_Amazon(constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ACCESSKEYID'), 'oops'); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('Unknown country code', $e->getMessage()); } } /** * @group ZF-2056 */ public function testMozardSearchFromFile() { $xml = file_get_contents(dirname(__FILE__)."/_files/mozart_result.xml"); $dom = new DOMDocument(); $dom->loadXML($xml); $mozartTracks = array( 'B00005A8JZ' => '29', 'B0000058HV' => '25', 'B000BLI3K2' => '500', 'B00004X0QF' => '9', 'B000004194' => '19', 'B00000I9M0' => '9', 'B000004166' => '20', 'B00002DEH1' => '58', 'B0000041EV' => '12', 'B00004SA87' => '42', ); $result = new Zend_Service_Amazon_ResultSet($dom); foreach($result AS $item) { $trackCount = $mozartTracks[$item->ASIN]; $this->assertEquals($trackCount, count($item->Tracks)); } } /** * @group ZF-2749 */ public function testSimilarProductConstructorMissingAttributeDoesNotThrowNotice() { $dom = new DOMDocument(); $asin = $dom->createElement("ASIN", "TEST"); $product = $dom->createElement("product"); $product->appendChild($asin); $similarproduct = new Zend_Service_Amazon_SimilarProduct($product); } }