public function testFetchInventoryListToken2()
 {
     resetLog();
     $this->object->setMock(true, array('fetchInventoryListToken.xml', 'fetchInventoryListToken2.xml'));
     //with using token
     $this->object->setUseToken();
     $this->assertNull($this->object->fetchInventoryList());
     $check = parseLog();
     $this->assertEquals('Mock files array set.', $check[1]);
     $this->assertEquals('Fetched Mock File: mock/fetchInventoryListToken.xml', $check[2]);
     $this->assertEquals('Recursively fetching more Inventory Supplies', $check[3]);
     $this->assertEquals('Fetched Mock File: mock/fetchInventoryListToken2.xml', $check[4]);
     $this->assertFalse($this->object->hasToken());
     $o = $this->object->getOptions();
     $this->assertEquals('ListInventorySupplyByNextToken', $o['Action']);
     $this->assertArrayNotHasKey('QueryStartDateTime', $o);
     $this->assertArrayNotHasKey('ResponseGroup', $o);
     $r = $this->object->getSupply(null);
     $this->assertArrayHasKey(0, $r);
     $this->assertArrayHasKey(1, $r);
     $this->assertEquals('SampleSKU1', $r[0]['SellerSKU']);
     $this->assertEquals('SampleSKU2', $r[1]['SellerSKU']);
     $this->assertEquals(2, count($r));
     $this->assertNotEquals($r[0], $r[1]);
 }
/**
 * This function will retrieve a list of all items with quantity that was adjusted within the past 24 hours.
 * The entire list of items is returned, with each item contained in an array.
 */
function getAmazonSupply()
{
    require '../includes/classes.php';
    //autoload classes, not needed if composer is being used
    try {
        $obj = new AmazonInventoryList("myStore");
        //store name matches the array key in the config file
        $obj->setUseToken();
        //tells the object to automatically use tokens right away
        $obj->setStartTime("- 24 hours");
        $obj->fetchInventoryList();
        //this is what actually sends the request
        return $obj->getSupply();
    } catch (Exception $ex) {
        echo 'There was a problem with the Amazon library. Error: ' . $ex->getMessage();
    }
}