public function testHttpDo() { $api = new \CashWay\API(array('API_URL' => 'http://127.0.0.1:81')); $res = $api->httpDo('GET', '/path/to/test', array('query' => 'value')); $this->assertEquals('curl_error', $res['errors'][0]['code']); $api = new \CashWay\API(get_conf()); $res = $api->httpDo('HEAD', '/path/to/test', array('query' => 'value')); $this->assertEquals('method_not_supported', $res['errors'][0]['code']); $res = $api->httpDo('GET', '/path/to/test', array('query' => 'value')); $this->assertEquals('GET', $res['method']); $this->assertEquals('/1/path/to/test?query=value', $res['request']); $this->assertJsonStringEqualsJsonString(json_encode(null), $res['body']); }
public function testCheckTransactions() { $api = new \CashWay\API(get_conf()); $res = $api->checkTransactionsForOrders(array()); $this->assertEquals('GET', $res['method']); $this->assertEquals('/1/shops/me/transactions?', $res['request']); $this->assertJsonStringEqualsJsonString(json_encode(null), $res['body']); }