mirror of
https://github.com/Mibew/java.git
synced 2025-01-23 01:50:34 +03:00
Updated tests for PHP's MibewAPI class to use MibewAPITestInteraction class instance
This commit is contained in:
parent
6c6a26225f
commit
2752ce5c25
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
require_once dirname(__FILE__) . '/../../../../webim/libs/classes/mibew_api.php';
|
require_once dirname(__FILE__) . '/../../../../webim/libs/classes/mibew_api.php';
|
||||||
require_once dirname(__FILE__) . '/../../../../webim/libs/classes/mibew_api_interaction.php';
|
require_once dirname(__FILE__) . '/../../../../webim/libs/classes/mibew_api_interaction.php';
|
||||||
require_once dirname(__FILE__) . '/../../../../webim/libs/classes/mibew_api_window_interaction.php';
|
require_once dirname(__FILE__) . '/mibew_api_test_interaction.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for MibewAPI.
|
* Test class for MibewAPI.
|
||||||
@ -11,15 +11,15 @@ require_once dirname(__FILE__) . '/../../../../webim/libs/classes/mibew_api_wind
|
|||||||
class MibewAPITest extends PHPUnit_Framework_TestCase {
|
class MibewAPITest extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
public function testGetAPI() {
|
public function testGetAPI() {
|
||||||
$mibew_api = MibewAPI::getAPI('MibewAPIWindowInteraction');
|
$mibew_api = MibewAPI::getAPI('MibewAPITestInteraction');
|
||||||
$this->assertEquals($mibew_api, MibewAPI::getAPI('MibewAPIWindowInteraction'));
|
$this->assertEquals($mibew_api, MibewAPI::getAPI('MibewAPITestInteraction'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @depends testGetAPI
|
* @depends testGetAPI
|
||||||
*/
|
*/
|
||||||
public function testCheckFunction() {
|
public function testCheckFunction() {
|
||||||
$api = MibewAPI::getAPI('MibewAPIWindowInteraction');
|
$api = MibewAPI::getAPI('MibewAPITestInteraction');
|
||||||
|
|
||||||
// Wrong function. Function name is absent
|
// Wrong function. Function name is absent
|
||||||
$wrong_function = array();
|
$wrong_function = array();
|
||||||
@ -167,7 +167,7 @@ class MibewAPITest extends PHPUnit_Framework_TestCase {
|
|||||||
* @depends testCheckFunction
|
* @depends testCheckFunction
|
||||||
*/
|
*/
|
||||||
public function testCheckRequest($correct_function) {
|
public function testCheckRequest($correct_function) {
|
||||||
$api = MibewAPI::getAPI('MibewAPIWindowInteraction');
|
$api = MibewAPI::getAPI('MibewAPITestInteraction');
|
||||||
|
|
||||||
// Wrong request. Its 'token' element is absent.
|
// Wrong request. Its 'token' element is absent.
|
||||||
$wrong_request = array();
|
$wrong_request = array();
|
||||||
@ -245,7 +245,7 @@ class MibewAPITest extends PHPUnit_Framework_TestCase {
|
|||||||
* @depends testCheckRequest
|
* @depends testCheckRequest
|
||||||
*/
|
*/
|
||||||
public function testCheckPackage($correct_request) {
|
public function testCheckPackage($correct_request) {
|
||||||
$api = MibewAPI::getAPI('MibewAPIWindowInteraction');
|
$api = MibewAPI::getAPI('MibewAPITestInteraction');
|
||||||
|
|
||||||
$trusted_signatures = array('some_trusted_signature');
|
$trusted_signatures = array('some_trusted_signature');
|
||||||
// Wrong package. Signature element is absent.
|
// Wrong package. Signature element is absent.
|
||||||
@ -417,7 +417,7 @@ class MibewAPITest extends PHPUnit_Framework_TestCase {
|
|||||||
* @depends testCheckPackage
|
* @depends testCheckPackage
|
||||||
*/
|
*/
|
||||||
public function testEncodePackage($correct_package) {
|
public function testEncodePackage($correct_package) {
|
||||||
$api = MibewAPI::getAPI('MibewAPIWindowInteraction');
|
$api = MibewAPI::getAPI('MibewAPITestInteraction');
|
||||||
|
|
||||||
// Get package values
|
// Get package values
|
||||||
$requests = $correct_package['requests'];
|
$requests = $correct_package['requests'];
|
||||||
@ -439,7 +439,7 @@ class MibewAPITest extends PHPUnit_Framework_TestCase {
|
|||||||
* @depends testEncodePackage
|
* @depends testEncodePackage
|
||||||
*/
|
*/
|
||||||
public function testDecodePackage($vars) {
|
public function testDecodePackage($vars) {
|
||||||
$api = MibewAPI::getAPI('MibewAPIWindowInteraction');
|
$api = MibewAPI::getAPI('MibewAPITestInteraction');
|
||||||
|
|
||||||
// Try to catch MibewAPIException with MibewAPIException::NOT_VALID_JSON code
|
// Try to catch MibewAPIException with MibewAPIException::NOT_VALID_JSON code
|
||||||
try {
|
try {
|
||||||
@ -472,7 +472,7 @@ class MibewAPITest extends PHPUnit_Framework_TestCase {
|
|||||||
* @depends testGetAPI
|
* @depends testGetAPI
|
||||||
*/
|
*/
|
||||||
public function testGetResultFunction() {
|
public function testGetResultFunction() {
|
||||||
$api = MibewAPI::getAPI('MibewAPIWindowInteraction');
|
$api = MibewAPI::getAPI('MibewAPITestInteraction');
|
||||||
|
|
||||||
// Wrong functions list. More than one result function.
|
// Wrong functions list. More than one result function.
|
||||||
$functions_list = array(
|
$functions_list = array(
|
||||||
@ -580,7 +580,7 @@ class MibewAPITest extends PHPUnit_Framework_TestCase {
|
|||||||
* @depends testGetAPI
|
* @depends testGetAPI
|
||||||
*/
|
*/
|
||||||
public function testBuildResult() {
|
public function testBuildResult() {
|
||||||
$api = MibewAPI::getAPI('MibewAPIWindowInteraction');
|
$api = MibewAPI::getAPI('MibewAPITestInteraction');
|
||||||
|
|
||||||
$token = 'some_test_token';
|
$token = 'some_test_token';
|
||||||
$package = array(
|
$package = array(
|
||||||
|
Loading…
Reference in New Issue
Block a user