<?php
require_once("ARESTAPITest.php");
class StoreRESTAPITest extends ARESTAPITest{
    
    public function __construct(){
        $this->module = "store";
    }
    public $orderItemId;

    public function testgetPurchasedItems(){
        $params = array();
        $params['userID']= $this->userId;
        $result = $this->makeSignedRequest($this->module, $this->version, "getPurchasedItems", $params);
        $this->assertTrue(is_numeric($result['items'][0]['orderItemID']));
        $this->assertTrue(is_numeric($result['items'][0]['gameItemID']));
        $this->assertTrue(is_numeric($result['items'][0]['orderTime']));
        $this->assertTrue(is_numeric($result['items'][0]['quantity']));
        $this->assertFalse($result['items'][0]['gameItemID']);
        $this->orderItemId = $result['items'][0]['orderItemID'];
    }
    
    public function testsetItemUsed(){
        $params= array();
        $params['userID']= $this->userId;
        $params['worldID']= 0;
        $params['characterID']= 0;//will need to create a test character for this, i think.
        $params['orderItemID']= $this->orderItemId; 
        $result = $this->makeSignedRequest($this->module, $this->version, "setItemUsed", $params);
        $this->assertTrue($result['result']);//check if this is correct
    }
    
    public function testsetItemActivated(){
        $params= array();
        $params['userID']= $this->userId;
        $params['worldID']= 0;
        $params['characterID']= 0;//will need to create a test character for this, i think.
        $params['orderItemID']= $this->orderItemId; 
        $result = $this->makeSignedRequest($this->module, $this->version, "setItemActivated", $params);
        $this->assertTrue($result['result']);//check if this is correct.
    }   
    public function testlistItems(){
        $params= array();
        $params['realm']= $this->realm;
        $params['modified'] = 0;
        $result = $this->makeSignedRequest($this->module, $this->version, "listItems", $params);
        
        //$result -> count
        $this->assertTrue(count($result['items'])==$result['count']);
        
        
        $json['items'][0]["itemid"];
        
    }
    public function testpurchaseItems(){
        $params= array();
        $params['userID']= $this->userId;
        $params['inGameItemIDs']= 0; 
        $result = $this->makeSignedRequest($this->module, $this->version, "purchaseItem", $params);
        $this->assertTrue(is_bool($result['result']));
        $this->assertTrue(is_numeric($result['total']));
        $this->assertTrue(is_string($result['transaction']));
        
        
        
    }
}



?>