From 6c6a26225f721c4c5033dd619ee9bae21536e4ae Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Wed, 22 Aug 2012 10:49:06 +0000 Subject: [PATCH] Added tests for the PHP's MibewAPIInteraction class --- .../webim/classes/MibewAPIInteractionTest.php | 61 +++++++++++++++++++ .../classes/mibew_api_test_interaction.php | 24 ++++++++ 2 files changed, 85 insertions(+) create mode 100644 src/messenger/tests/server_side/webim/classes/MibewAPIInteractionTest.php create mode 100644 src/messenger/tests/server_side/webim/classes/mibew_api_test_interaction.php diff --git a/src/messenger/tests/server_side/webim/classes/MibewAPIInteractionTest.php b/src/messenger/tests/server_side/webim/classes/MibewAPIInteractionTest.php new file mode 100644 index 00000000..98965415 --- /dev/null +++ b/src/messenger/tests/server_side/webim/classes/MibewAPIInteractionTest.php @@ -0,0 +1,61 @@ +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 + ) + ); + } +} + +?> diff --git a/src/messenger/tests/server_side/webim/classes/mibew_api_test_interaction.php b/src/messenger/tests/server_side/webim/classes/mibew_api_test_interaction.php new file mode 100644 index 00000000..f1aba947 --- /dev/null +++ b/src/messenger/tests/server_side/webim/classes/mibew_api_test_interaction.php @@ -0,0 +1,24 @@ + array( + 'return' => array(), + 'references' => array() + ), + 'foo' => array( + 'bar' => 127 + ) + ); + + public $reservedFunctionNames = array( + 'result' + ); + +} + +?>