本文整理汇总了PHP中Contao\Input::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::initialize方法的具体用法?PHP Input::initialize怎么用?PHP Input::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contao\Input
的用法示例。
在下文中一共展示了Input::initialize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetPost
/**
* 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));
}
示例2: testGetPost
/**
* 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);
}
示例3: initializeFramework
/**
* 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();
}
示例4: initializeFramework
/**
* 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();
}