/** * Create testing environment */ protected function setUp() { global $_SERVER; $this->serverBackup = $_SERVER; $_SERVER = array(); $this->frameworkInstance = Framework::run(); }
public function testRegisterNamespace() { // Init the framework if it not yet inited Framework::run(); // Register a wrong namespace $this->assertTrue(Framework::registerNamespace('Facula\\Temp\\SubNamespace', static::$testingDir)); // Check if the class exist, it should not $this->assertFalse(class_exists('Facula\\Temp\\SubNamespace\\Demo2', true)); // Check if the file has been loaded, // Auto loader will load it, so it should be // If the file loaded, the class should be registered $this->assertTrue(class_exists('Facula\\Temp\\Demo2', true)); // Unregister this namespace $this->assertTrue(\Facula\Framework::unregisterNamespace('Facula\\Temp\\SubNamespace', static::$testingDir)); // Check if the third class exists, it should not. $this->assertFalse(class_exists('Facula\\Temp\\SubNamespace\\Demo3', true)); // Check if the Demo3 class file has loaded, it should not. $this->assertFalse(class_exists('Facula\\Temp\\Demo3', true)); // Register the correct namespace $this->assertTrue(Framework::registerNamespace('Facula\\Temp', static::$testingDir)); // Check if the class exist, it should be $this->assertTrue(class_exists('Facula\\Temp\\Demo3', true)); }
public static function get() { $cfg = $common = array(); $f = Framework::run(); return new static($cfg, $common, $f); }