/** * Sets the Factory pointers * * @return void * * @since 12.1 */ protected function restoreFactoryState() { JFactory::$application = $this->_stashedFactoryState['application']; JFactory::$config = $this->_stashedFactoryState['config']; JFactory::$container = $this->_stashedFactoryState['container']; JFactory::$dates = $this->_stashedFactoryState['dates']; JFactory::$session = $this->_stashedFactoryState['session']; JFactory::$language = $this->_stashedFactoryState['language']; JFactory::$document = $this->_stashedFactoryState['document']; JFactory::$acl = $this->_stashedFactoryState['acl']; JFactory::$mailer = $this->_stashedFactoryState['mailer']; JFactory::$database = $this->_stashedFactoryState['database']; }
<?php /** * @package Joomla.Installation * @subpackage Application * * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; // Define the base path and require the other defines define('JPATH_BASE', dirname(__DIR__)); require_once __DIR__ . '/defines.php'; // Launch the application require_once __DIR__ . '/framework.php'; // Register the Installation application JLoader::registerPrefix('Installation', JPATH_INSTALLATION); // Register the application's router due to non-standard include JLoader::register('JRouterInstallation', __DIR__ . '/router.php'); // Instantiate the dependency injection container JFactory::$container = (new \Joomla\DI\Container())->registerServiceProvider(new InstallationServiceProviderApplication())->registerServiceProvider(new InstallationServiceProviderSession())->registerServiceProvider(new \Joomla\Cms\Service\Provider\Dispatcher())->registerServiceProvider(new \Joomla\Cms\Service\Provider\Database());
/** * Testing activateUser(). * * @param string $activation Activation string * @param boolean $expected Expected params * * @dataProvider casesActivateUser * @covers JUserHelper::activateUser * @return void * * @since 12.3 */ public function testActivateUser($activation, $expected) { // Configure the container $container = (new \Joomla\DI\Container())->set('dispatcher', $this->getMockDispatcher())->set('db', static::$driver); JFactory::$container = $container; $this->assertEquals(JUserHelper::activateUser($activation), $expected); }
/** * Get a container object * * Returns the global service container object, only creating it if it doesn't already exist. * * @return Container * * @since 4.0 */ public static function getContainer() { if (!self::$container) { self::$container = self::createContainer(); } return self::$container; }