|
|
@@ -328,4 +328,50 @@ class Zend_Service_Amazon_OfflineTest extends PHPUnit_Framework_TestCase
|
|
|
))
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Testing if Amazon service component can handle return values where the
|
|
|
+ * item-list is not empty
|
|
|
+ *
|
|
|
+ * @group ZF-9547
|
|
|
+ */
|
|
|
+ public function testAmazonComponentHandlesValidBookResults()
|
|
|
+ {
|
|
|
+ $xml = file_get_contents(dirname(__FILE__)."/_files/amazon-response-valid.xml");
|
|
|
+ $dom = new DOMDocument();
|
|
|
+ $dom->loadXML($xml);
|
|
|
+
|
|
|
+ $result = new Zend_Service_Amazon_ResultSet($dom);
|
|
|
+
|
|
|
+ $currentItem = null;
|
|
|
+ try {
|
|
|
+ $currentItem = $result->current();
|
|
|
+ } catch (Zend_Service_Amazon_Exception $e) {
|
|
|
+ $this->fail('Unexpected exception was triggered');
|
|
|
+ }
|
|
|
+ $this->assertType('Zend_Service_Amazon_Item', $currentItem);
|
|
|
+ $this->assertEquals('0754512673', $currentItem->ASIN);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Testing if Amazon service component can handle return values where the
|
|
|
+ * item-list is empty (no results found)
|
|
|
+ *
|
|
|
+ * @group ZF-9547
|
|
|
+ */
|
|
|
+ public function testAmazonComponentHandlesEmptyBookResults()
|
|
|
+ {
|
|
|
+ $xml = file_get_contents(dirname(__FILE__)."/_files/amazon-response-invalid.xml");
|
|
|
+ $dom = new DOMDocument();
|
|
|
+ $dom->loadXML($xml);
|
|
|
+
|
|
|
+ $result = new Zend_Service_Amazon_ResultSet($dom);
|
|
|
+
|
|
|
+ try {
|
|
|
+ $result->current();
|
|
|
+ $this->fail('Expected exception was not triggered');
|
|
|
+ } catch (Zend_Service_Amazon_Exception $e) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|