public function testFindPriceCall() { $ret = array('data' => array('test' => 'ok')); $stub = $this->getMock('Mtgim_Api_Adapter_Curl'); $stub->expects($this->once())->method('callMethod')->with($this->equalTo('find-price'), $this->equalTo(array('AccessKey' => 'testKey', 'Shop' => 'rishada', 'FoilType' => 'R', 'Signature' => 'fdfc0f4016a5d24ede15d610a7598c46e0d26a8a', 'CardName' => 'Disenchant')))->willReturn($ret); $o = new Mtgim_Api_Client('testKey', 'testSecret', $stub); $this->assertEquals($ret['data'], $o->findPrice('Disenchant', 'rishada', 'R')); }
$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)) { $message = 'Neplatné parametry!'; } else { // form is valid, find results $results = $mtgim->findPrice($cardname, $selectedShop, $selectedType); if (empty($results)) { $message = 'Vašemu hledání neodpovídá žádný výsledek'; } else { $showResults = TRUE; } } } // ========== HTML ========= ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" media="screen" href="mtgim-api-example.css">