public function testFetchOrderItemsToken2() { resetLog(); $this->object->setMock(true, array('fetchOrderItemsToken.xml', 'fetchOrderItemsToken2.xml')); $this->object->setOrderId('058-1233752-8214740'); //with using token $this->object->setUseToken(); $this->assertNull($this->object->fetchItems()); $check = parseLog(); $this->assertEquals('Mock files array set.', $check[1]); $this->assertEquals('Fetched Mock File: mock/fetchOrderItemsToken.xml', $check[2]); $this->assertEquals('Recursively fetching more items', $check[3]); $this->assertEquals('Fetched Mock File: mock/fetchOrderItemsToken2.xml', $check[4]); $this->assertFalse($this->object->hasToken()); $o = $this->object->getOptions(); $this->assertEquals('ListOrderItemsByNextToken', $o['Action']); $this->assertArrayNotHasKey('AmazonOrderId', $o); $r = $this->object->getItems(); $this->assertArrayHasKey(0, $r); $this->assertArrayHasKey(1, $r); $this->assertEquals('CBA_OTF_1', $r[0]['SellerSKU']); $this->assertEquals('CBA_OTF_5', $r[1]['SellerSKU']); $this->assertEquals(2, count($r)); $this->assertNotEquals($r[0], $r[1]); }
/** * Fetches items for the order from Amazon. * * See the <i>AmazonOrderItemList</i> class for more information on the returned object. * @param boolean $token [optional] <p>whether or not to automatically use item tokens in the request</p> * @return AmazonOrderItemList container for order's items */ public function fetchItems($token = false) { if (!isset($this->data['AmazonOrderId'])) { return false; } if (!is_bool($token)) { $token = false; } $items = new AmazonOrderItemList($this->storeName, $this->data['AmazonOrderId'], $this->mockMode, $this->mockFiles, $this->config); $items->setLogPath($this->logpath); $items->mockIndex = $this->mockIndex; $items->setUseToken($token); $items->fetchItems(); return $items; }