public static function tearDownAfterClass() { TestJoomlaPlatform::$baseDirs = null; TestJoomlaPlatform::$template = null; TestJoomlaPlatform::$templateSuffixes = null; parent::tearDownAfterClass(); }
protected function setUp() { parent::setUp(); // Force a JDocumentHTML instance $this->saveFactoryState(); JFactory::$document = JDocument::getInstance('html'); // Fake the server variables to get JURI working right global $_SERVER; $this->_stashedServer = $_SERVER; $_SERVER['HTTP_HOST'] = 'www.example.com'; $_SERVER['REQUEST_URI'] = '/index.php?option=com_foobar'; $_SERVER['SCRIPT_NAME'] = '/index.php'; // Fake the session JFactory::$session = $this->getMockSession(); $application = JFactory::getApplication('site'); // Reset the fake platform TestJoomlaPlatform::$template = null; TestJoomlaPlatform::$baseDirs = null; TestJoomlaPlatform::$isAdmin = null; TestJoomlaPlatform::$isCli = null; TestJoomlaPlatform::$templateSuffixes = null; // Reset JURI $reflector = new \ReflectionClass('\\JUri'); $instancesProp = $reflector->getProperty('instances'); $instancesProp->setAccessible(true); $instancesProp->setValue(array()); $baseProp = $reflector->getProperty('base'); $baseProp->setAccessible(true); $baseProp->setValue(array()); $rootProp = $reflector->getProperty('root'); $rootProp->setAccessible(true); $rootProp->setValue(array()); // Fake the template $template = (object) array('template' => 'fake_test_template'); $attribute = new ReflectionProperty($application, 'template'); $attribute->setAccessible(TRUE); $attribute->setValue($application, $template); }