mirror of
				https://github.com/Mibew/java.git
				synced 2025-10-31 10:31:07 +03:00 
			
		
		
		
	Added tests for the PHP's MibewAPIInteraction class
This commit is contained in:
		
							parent
							
								
									b0225eadeb
								
							
						
					
					
						commit
						6c6a26225f
					
				| @ -0,0 +1,61 @@ | ||||
| <?php | ||||
| 
 | ||||
| require_once dirname(__FILE__) . '/../../../../webim/libs/classes/mibew_api_interaction.php'; | ||||
| require_once dirname(__FILE__) . '/mibew_api_test_interaction.php'; | ||||
| 
 | ||||
| /** | ||||
|  * Test class for MibewAPIInteraction. | ||||
|  */ | ||||
| class MibewAPIInteractionTest extends PHPUnit_Framework_TestCase { | ||||
| 
 | ||||
| 	/** | ||||
| 	 * An instance of the MibewAPITestInteraction | ||||
| 	 * @var MibewAPITestInteraction | ||||
| 	 */ | ||||
| 	protected $object = null; | ||||
| 
 | ||||
| 	protected function setUp() { | ||||
| 		$this->object = new MibewAPITestInteraction(); | ||||
| 	} | ||||
| 
 | ||||
| 	protected function tearDown() { | ||||
| 		unset($this->object); | ||||
| 	} | ||||
| 
 | ||||
| 	public function testGetObligatoryArguments() { | ||||
| 		// Test obligatory arguments for all functions
 | ||||
| 		$this->assertEquals( | ||||
| 			$this->object->getObligatoryArguments('some_default_function'), | ||||
| 			array('return', 'references') | ||||
| 		); | ||||
| 
 | ||||
| 		// Test obligatory argumens for specific function
 | ||||
| 		$this->assertEquals( | ||||
| 			$this->object->getObligatoryArguments('foo'), | ||||
| 			array('return', 'references', 'bar') | ||||
| 		); | ||||
| 	} | ||||
| 
 | ||||
| 	public function testGetObligatoryArgumentsDefaults() { | ||||
| 		// Test default values for obligatory arguments for all functions
 | ||||
| 		$this->assertEquals( | ||||
| 			$this->object->getObligatoryArgumentsDefaults('some_default_function'), | ||||
| 			array( | ||||
| 				'return' => array(), | ||||
| 				'references' => array() | ||||
| 			) | ||||
| 		); | ||||
| 
 | ||||
| 		// Test default values for obligatory argumens for specific function
 | ||||
| 		$this->assertEquals( | ||||
| 			$this->object->getObligatoryArgumentsDefaults('foo'), | ||||
| 			array( | ||||
| 				'return' => array(), | ||||
| 				'references' => array(), | ||||
| 				'bar' => 127 | ||||
| 			) | ||||
| 		); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| ?>
 | ||||
| @ -0,0 +1,24 @@ | ||||
| <?php | ||||
| 
 | ||||
| /** | ||||
|  * Test interaction type for the Mibew API | ||||
|  */ | ||||
| class MibewAPITestInteraction extends MibewAPIInteraction { | ||||
| 
 | ||||
| 	protected $obligatoryArguments = array( | ||||
| 		'*' => array( | ||||
| 			'return' => array(), | ||||
| 			'references' => array() | ||||
| 		), | ||||
| 		'foo' => array( | ||||
| 			'bar' => 127 | ||||
| 		) | ||||
| 	); | ||||
| 
 | ||||
| 	public $reservedFunctionNames = array( | ||||
| 		'result' | ||||
| 	); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| ?>
 | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user