当前位置: 首页>>代码示例>>PHP>>正文


PHP ErrorPage::get_content_for_errorcode方法代码示例

本文整理汇总了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');
 }
开发者ID:helpfulrobot,项目名称:comperio-silverstripe-cms,代码行数:22,代码来源:ErrorPageTest.php

示例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');
 }
开发者ID:ryanwachtl,项目名称:silverstripe-cms,代码行数:17,代码来源:ErrorPageTest.php


注:本文中的ErrorPage::get_content_for_errorcode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。