* @license PHP License * @package WB * @subpackage unittest */ /** * Unit Test * * TestBaseClass * * @version 0.3.0 * @package WB * @subpackage unittest */ class TestCaseClass extends UnitTestCase { public function testClass() { $genesis = WBParam::get( 'wb/time/genesis', '123' ); $this->assertTrue( class_exists( 'WBClass', false ) ); } public function xtestPhpInclude() { $wbInc = implode(PATH_SEPARATOR, WBParam::get('wb/class/phpincludepath')); $phpInc = get_include_path(); $this->assertEqual($wbInc, $phpInc); } public function xtestLoader() { // load loacal classes $this->assertTrue( WBClass::load( 'WBClock' ) ); $this->assertTrue( WBClass::load( 'WBStream', 'WBParam', 'WBClass' ) ); $this->assertTrue( WBClass::load( 'PEAR' ) ); $this->assertTrue( WBClass::load( 'XML_Serializer', 'XML_Beautifier' ) ); } public function xtestAutoLoader() { $this->assertFalse( class_exists( 'Non_Existing_Class', false ) ); $this->assertFalse( class_exists( 'WBFormProcessor', false ) ); $this->assertFalse( class_exists( 'WBService', false ) ); WBParam::set( 'wb/class/autoload', true ); $this->assertTrue( class_exists( 'XML_Parser', true ) ); $this->assertTrue( class_exists( 'WBFormProcessor', true ) ); WBParam::set( 'wb/class/autoload', false ); $this->assertFalse( class_exists( 'PEAR_REST', true ) ); $this->assertFalse( class_exists( 'WBService', true ) ); } public function xtestStaticConstruct() { $this->assertFalse( class_exists( 'WBUTClazz', false ) ); WBClass::load( 'WBUTClazz' ); $clazzes = WBClass::getLoaded(); $this->assertTrue( class_exists( 'WBUTClazz', false ) ); $this->assertEqual( 1, WBUTClazz::getSetup() ); $o1 = WBClass::create('WBUTClazz'); $this->assertEqual( 1, WBUTClazz::getSetup() ); $this->assertEqual( 1, WBUTClazz::getCount() ); $o2 = WBClass::create('WBUTClazz'); $this->assertEqual( 1, WBUTClazz::getSetup() ); $this->assertEqual( 2, WBUTClazz::getCount() ); $o3 = WBClass::create('WBUTClazz'); $this->assertEqual( 1, WBUTClazz::getSetup() ); $this->assertEqual( 3, WBUTClazz::getCount() ); unset( $o1 ); $this->assertEqual( 1, WBUTClazz::getSetup() ); $this->assertEqual( 2, WBUTClazz::getCount() ); unset( $o2 ); $this->assertEqual( 1, WBUTClazz::getSetup() ); $this->assertEqual( 1, WBUTClazz::getCount() ); unset( $o3 ); $this->assertEqual( 1, WBUTClazz::getSetup() ); $this->assertEqual( 0, WBUTClazz::getCount() ); } public function xtestPat() { WBClass::load('patError'); $this->assertTrue( class_exists('patErrorManager', false)); $this->assertTrue( class_exists('patError', false)); } public function testLoadDatasource() { $this->assertTrue(WBClass::load('WBDatasource_Callback')); $this->assertTrue(WBClass::load('WBDatasource_Callback')); } } ?>