本文整理汇总了PHP中ErrorPage::get_content_for_errorcode方法的典型用法代码示例。如果您正苦于以下问题:PHP ErrorPage::get_content_for_errorcode方法的具体用法?PHP ErrorPage::get_content_for_errorcode怎么用?PHP ErrorPage::get_content_for_errorcode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorPage
的用法示例。
在下文中一共展示了ErrorPage::get_content_for_errorcode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGeneratedFile
/**
* Test fallback to file generation API with enable_static_file disabled
*/
public function testGeneratedFile()
{
Config::inst()->update('ErrorPage', 'enable_static_file', false);
$this->logInWithPermission('ADMIN');
$page = new ErrorPage();
$page->ErrorCode = 405;
$page->Title = 'Method Not Allowed';
$page->write();
$page->doPublish();
// Dynamic content is available
$response = ErrorPage::response_for('405');
$this->assertNotEmpty($response);
$this->assertNotEmpty($response->getBody());
$this->assertEquals(405, (int) $response->getStatusCode());
// Static content is not available
$this->assertEmpty(ErrorPage::get_content_for_errorcode('405'));
$expectedErrorPagePath = AssetStoreTest_SpyStore::base_path() . '/error-405.html';
$this->assertFileNotExists($expectedErrorPagePath, 'Error page is not cached in static location');
}
示例2: testGeneratedFile
/**
* Test fallback to file generation API with enable_static_file disabled
*/
public function testGeneratedFile()
{
Config::inst()->update('ErrorPage', 'enable_static_file', false);
$this->logInWithPermission('ADMIN');
$page = new ErrorPage();
$page->ErrorCode = 405;
$page->Title = 'Method Not Allowed';
$page->write();
$page->doPublish();
// Error content is available, even though the static file does not exist (only in assetstore)
$this->assertNotEmpty(ErrorPage::get_content_for_errorcode('405'));
$expectedErrorPagePath = AssetStoreTest_SpyStore::base_path() . '/error-405.html';
$this->assertFileNotExists($expectedErrorPagePath, 'Error page is not cached in static location');
}