initialize() public static method

Clean the global GPC arrays
public static initialize ( )
Beispiel #1
0
 /**
  * Tests the getPost() method.
  *
  * @dataProvider postProvider
  */
 public function testGetPost($key, $input, $value, $expected)
 {
     $widget = $this->getMock('Contao\\Widget');
     $class = new \ReflectionClass('Contao\\Widget');
     $method = $class->getMethod('getPost');
     $method->setAccessible(true);
     $_POST[$input] = $value;
     Input::resetCache();
     Input::initialize();
     $this->assertEquals($expected, $method->invoke($widget, $key));
 }
Beispiel #2
0
 /**
  * Tests the getPost() method.
  *
  * @param string $key
  * @param string $input
  * @param mixed  $value
  * @param string $expected
  *
  * @dataProvider postProvider
  */
 public function testGetPost($key, $input, $value, $expected)
 {
     // Prevent "undefined index" errors
     $errorReporting = error_reporting();
     error_reporting($errorReporting & ~E_NOTICE);
     $widget = $this->getMock('Contao\\Widget');
     $class = new \ReflectionClass('Contao\\Widget');
     $method = $class->getMethod('getPost');
     $method->setAccessible(true);
     $_POST[$input] = $value;
     Input::resetCache();
     Input::initialize();
     $this->assertEquals($expected, $method->invoke($widget, $key));
     // Restore the error reporting level
     error_reporting($errorReporting);
 }
 /**
  * Initializes the framework.
  */
 private function initializeFramework()
 {
     // Set the error_reporting level
     error_reporting($this->errorLevel);
     $this->includeHelpers();
     // TODO: use Monolog to log errors
     $this->iniSet('error_log', $this->rootDir . '/system/logs/error.log');
     $this->includeBasicClasses();
     // Set the container
     System::setContainer($this->container);
     // Preload the configuration (see #5872)
     $this->config->preload();
     // Register the class loader
     ClassLoader::scanAndRegister();
     $this->initializeLegacySessionAccess();
     $this->setDefaultLanguage();
     // Fully load the configuration
     $this->config->initialize();
     $this->validateInstallation();
     Input::initialize();
     $this->setTimezone();
     // Set the mbstring encoding
     if (USE_MBSTRING && function_exists('mb_regex_encoding')) {
         mb_regex_encoding($this->config->get('characterSet'));
     }
     $this->triggerInitializeSystemHook();
     $this->handleRequestToken();
 }
Beispiel #4
0
 /**
  * Initializes the framework.
  */
 private function initializeFramework()
 {
     // Set the error_reporting level
     error_reporting($this->errorLevel);
     $this->includeHelpers();
     $this->includeBasicClasses();
     // Set the container
     System::setContainer($this->container);
     /** @var Config $config */
     $config = $this->getAdapter('Contao\\Config');
     // Preload the configuration (see #5872)
     $config->preload();
     // Register the class loader
     ClassLoader::scanAndRegister();
     $this->initializeLegacySessionAccess();
     $this->setDefaultLanguage();
     // Fully load the configuration
     $config->getInstance();
     $this->validateInstallation();
     Input::initialize();
     $this->setTimezone();
     $this->triggerInitializeSystemHook();
     $this->handleRequestToken();
 }