public function testFetchShipmentsToken2()
 {
     resetLog();
     $this->object->setMock(true, array('fetchShipmentItemsToken.xml', 'fetchShipmentItemsToken2.xml'));
     //with using token
     $this->object->setUseToken();
     $this->object->setShipmentId('123');
     $this->assertNull($this->object->fetchItems());
     $check = parseLog();
     $this->assertEquals('Mock files array set.', $check[1]);
     $this->assertEquals('Fetched Mock File: mock/fetchShipmentItemsToken.xml', $check[2]);
     $this->assertEquals('Recursively fetching more shipment items', $check[3]);
     $this->assertEquals('Fetched Mock File: mock/fetchShipmentItemsToken2.xml', $check[4]);
     $this->assertFalse($this->object->hasToken());
     $o = $this->object->getOptions();
     $this->assertEquals('ListInboundShipmentItemsByNextToken', $o['Action']);
     $r = $this->object->getItems();
     $this->assertArrayHasKey(0, $r);
     $this->assertArrayHasKey(1, $r);
     $this->assertEquals(2, count($r));
     $this->assertInternalType('array', $r[0]);
     $this->assertInternalType('array', $r[1]);
     $this->assertNotEquals($r[0], $r[1]);
 }
 /**
  * Returns array of item lists or a single item list.
  * 
  * If <i>$i</i> is not specified, the method will fetch the items for every
  * shipment in the list. Please note that for lists with a high number of shipments,
  * this operation could take a while due to throttling. (Two seconds per order when throttled.)
  * @param int $i [optional] <p>List index to retrieve the value from. Defaults to null.</p>
  * @param boolean $token [optional] <p>whether or not to automatically use tokens when fetching items.</p>
  * @return array|AmazonShipmentItemList <i>AmazonShipmentItemList</i> object or array of objects, or <b>FALSE</b> if non-numeric index
  */
 public function fetchItems($i = null, $token = false)
 {
     if (!isset($this->shipmentList)) {
         return false;
     }
     if (is_null($i)) {
         $a = array();
         $n = 0;
         foreach ($this->shipmentList as $x) {
             $a[$n] = new AmazonShipmentItemList($this->storeName, $x['ShipmentId'], $this->mockMode, $this->mockFiles, $this->config);
             $a[$n]->setUseToken($token);
             $a[$n]->mockIndex = $this->mockIndex;
             $a[$n]->fetchItems();
             $n++;
         }
         return $a;
     } else {
         if (is_int($i)) {
             $temp = new AmazonShipmentItemList($this->storeName, $this->shipmentList[$i]['ShipmentId'], $this->mockMode, $this->mockFiles, $this->config);
             $temp->setUseToken($token);
             $temp->mockIndex = $this->mockIndex;
             $temp->fetchItems();
             return $temp;
         } else {
             return false;
         }
     }
 }