Example #1
0
 public function testShopsAvailableCall()
 {
     $ret = array('data' => array('test' => 'ok'));
     $stub = $this->getMock('Mtgim_Api_Adapter_Curl');
     $stub->expects($this->once())->method('callMethod')->with($this->equalTo('shops-available'), $this->equalTo(array('AccessKey' => 'testKey')))->willReturn($ret);
     $o = new Mtgim_Api_Client('testKey', 'testSecret', $stub);
     $this->assertEquals($ret['data'], $o->shopsAvailable('Disenchant', 'rishada', 'R'));
 }
Example #2
0
 * (you should cache results of method Mtgim_Api_Client::shopsAvailable), nor advanced settings
 * of Adapter. For more information refer to documentation.
 */
// ==========  SETTINGS  =========
// these settings are testing ones - you will get only fake results
// you can change them to your production settings
// if you do not have production setting, contact us
$apiKey = 'testKey';
$secret = 'testSecret';
// ==========  MAGIC =========
// include library
require_once __DIR__ . '/mtgim-api-lib/Client.php';
// instantiate library
$mtgim = new Mtgim_Api_Client($apiKey, $secret);
// get list of available shops
$shops = $mtgim->shopsAvailable();
// get list of available card types
$cardTypes = $mtgim->typesAvailable();
// local variables
$showResults = FALSE;
$message = NULL;
$cardname = '';
$selectedShop = '';
$selectedType = '';
// if form was sent, try to find card results
if (isset($_POST['cardname']) && !empty($_POST['cardname'])) {
    $cardname = $_POST['cardname'];
    $selectedShop = $_POST['shop'];
    $selectedType = $_POST['foil'];
    // make sure values are valid
    if (!array_key_exists($selectedShop, $shops) || !array_key_exists($selectedType, $cardTypes)) {