<?php
$basedir = dirname(__FILE__);
require_once($basedir . '/lib/basetestdev.php');
define("PHONE", "xxx");
define("PWD", "xxx");
define("POSTURL","xxx");
class TestAPI extends PHPUnit_Framework_TestCase {
private function call_http($path, $param, $expect = 'ok') {
$_param = build_get_param($param);
$url = PREFIX . "$path?" . $_param;
$buf = do_Get($url);
$obj = json_decode($buf, True);
$this->assertEquals($obj['retval'], $expect);
return $obj;
}
private function call_https($path, $param, $expect = 'ok') {
$_param = build_get_param($param);
$url = HTTPSPREFIX . "$path?" . $_param;
$buf = do_Get($url);
$obj = json_decode($buf, True);
$this->assertEquals($obj['retval'], $expect);
return $obj;
}
public function testLogin(){
$param = array(
'type' => 'phone'
,'token' => PHONE
,'password' => PWD
);
$url = 'login';
return $this->call_http($url, $param);
}
/**
* @depends testLogin
*/
public function testInfo(array $user){
$session = $user['retinfo']['session'];
$param = array(
'session' => $session
);
$url ='info';
return $this->call_http($url, $param);
}