From 61bb16ee2e5f0a66234e1575242169a10fde47b5 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 7 Jul 2006 14:54:15 +0000 Subject: Merge from 3.0 branch till 1253. --- tests/UnitTests/framework/common.php | 99 ------------------------------------ 1 file changed, 99 deletions(-) delete mode 100644 tests/UnitTests/framework/common.php (limited to 'tests/UnitTests/framework/common.php') diff --git a/tests/UnitTests/framework/common.php b/tests/UnitTests/framework/common.php deleted file mode 100644 index 059dd142..00000000 --- a/tests/UnitTests/framework/common.php +++ /dev/null @@ -1,99 +0,0 @@ - - */ -class PradoUnitTestCase extends UnitTestCase { - - /** - * Tests whether the given code results in an appropriate exception being raised. - * @param string the PHP code to execute. must end with a semi-colon. - * @param string the type of exception that should be raised. - * @return boolean true - */ - public function assertException(string $code, string $exceptionType) { - $ex = null; - eval("try { $code } catch ($exceptionType \$e) { \$ex = \$e; }"); - $this->assertIsA($ex, $exceptionType); - } -} - - - -/** - * Generate a class called MockTApplication to mock the TApplication class - * for the purpose of testing IModule objects. - */ -__autoload("TApplication"); -Mock::generate("TApplication"); - -/** - * ModuleTestCase class. - * - * Provides functionality designed to support testing of objects implementing the IModule - * interface. - * - * Also provides some specific tests for IModule objects. - * - * @author Alex Flint - */ - -class ModuleTestCase extends PradoUnitTestCase { - - protected $module = null; - protected $mockApplication = null; - - public function __construct() { - $file = ""; - $tihs->mockApplication = new MockTApplication($file); - } - - public function testGetSetID() { - if ($this->module instanceof IModule) { - $this->module->setId(123); - $this->assertEqual($this->module->getId(123)); - } - } - - /** - * Initializes $this->module by calling the init() method with the provided configuration. - * If no application object is provided then a mock application object $this->mockApplication. - * @param array optional. The configuration array to provide to the module. If none provided then - * an empty array will be used. - * @param TApplication optional. The TApplication to pass to the init() function of the module. - * If none provided then $this->mockApplication will be used. - */ - public function initModule($config=array(), $application=null) { - if ($this->module instanceof IModule) { - if (is_null($application)) { - $application =& $this->mockApplication; - } - $this->module->init($config, $application); - } - } -} - -?> \ No newline at end of file -- cgit v1.2.3