本文整理匯總了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();
}