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


PHP SiteTree::disable_nested_urls方法代码示例

本文整理汇总了PHP中SiteTree::disable_nested_urls方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteTree::disable_nested_urls方法的具体用法?PHP SiteTree::disable_nested_urls怎么用?PHP SiteTree::disable_nested_urls使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SiteTree的用法示例。


在下文中一共展示了SiteTree::disable_nested_urls方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: tearDown

 /**
  * New tests require nested urls to be enabled, but the site might not 
  * support nested URLs. 
  * This setup will enable nested-urls for this test and resets the state
  * after the tests have been performed.
  */
 function tearDown()
 {
     if (isset($this->orig['nested_urls']) && !$this->orig['nested_urls']) {
         SiteTree::disable_nested_urls();
     }
     parent::tearDown();
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:13,代码来源:ModelAsControllerTest.php

示例2: testGetHomepageLink

	public function testGetHomepageLink() {
		$default = $this->objFromFixture('Page', 'home');
		
		SiteTree::disable_nested_urls();
		$this->assertEquals('home', RootURLController::get_homepage_link());
		SiteTree::enable_nested_urls();
		$this->assertEquals('home', RootURLController::get_homepage_link());
	}
开发者ID:redema,项目名称:silverstripe-cms,代码行数:8,代码来源:RootURLControllerTest.php

示例3: testDeepNestedURLs

 public function testDeepNestedURLs()
 {
     SiteTree::enable_nested_urls();
     $page = new Page();
     $page->URLSegment = 'base-page';
     $page->write();
     for ($i = 0; $i < 10; $i++) {
         $parentID = $page->ID;
         $page = new ContentControllerTest_Page();
         $page->ParentID = $parentID;
         $page->Title = "Page Level {$i}";
         $page->URLSegment = "level-{$i}";
         $page->write();
         $relativeLink = Director::makeRelative($page->Link());
         $this->assertEquals($page->Title, $this->get($relativeLink)->getBody());
     }
     SiteTree::disable_nested_urls();
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:18,代码来源:ContentControllerTest.php

示例4: testGetHomepageLink

 public function testGetHomepageLink()
 {
     $default = $this->objFromFixture('Page', 'home');
     $nested = $this->objFromFixture('Page', 'nested');
     SiteTree::disable_nested_urls();
     $this->assertEquals('home', RootURLController::get_homepage_link());
     SiteTree::enable_nested_urls();
     $this->assertEquals('home', RootURLController::get_homepage_link());
     $nested->HomepageForDomain = str_replace('www.', null, $_SERVER['HTTP_HOST']);
     $nested->write();
     RootURLController::reset();
     SiteTree::disable_nested_urls();
     $this->assertEquals('nested-home', RootURLController::get_homepage_link());
     RootURLController::reset();
     SiteTree::enable_nested_urls();
     $this->assertEquals('home/nested-home', RootURLController::get_homepage_link());
     $nested->HomepageForDomain = null;
     $nested->write();
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:19,代码来源:RootURLControllerTest.php

示例5: tearDown

 function tearDown()
 {
     // Preserve memory settings
     ini_set('memory_limit', $this->originalMemoryLimit ? $this->originalMemoryLimit : -1);
     // Restore email configuration
     Email::set_mailer($this->originalMailer);
     $this->originalMailer = null;
     $this->mailer = null;
     // Restore password validation
     Member::set_password_validator($this->originalMemberPasswordValidator);
     // Restore requirements
     Requirements::set_backend($this->originalRequirements);
     // Mark test as no longer being run - we use originalIsRunningTest to allow for nested SapphireTest calls
     self::$is_running_test = $this->originalIsRunningTest;
     $this->originalIsRunningTest = null;
     // Reset theme setting
     SSViewer::set_theme($this->originalTheme);
     // Reset mocked datetime
     SS_Datetime::clear_mock_now();
     // Restore nested_urls state
     if ($this->originalNestedURLsState) {
         SiteTree::enable_nested_urls();
     } else {
         SiteTree::disable_nested_urls();
     }
     // Stop the redirection that might have been requested in the test.
     // Note: Ideally a clean Controller should be created for each test.
     // Now all tests executed in a batch share the same controller.
     $controller = Controller::has_curr() ? Controller::curr() : null;
     if ($controller && $controller->response && $controller->response->getHeader('Location')) {
         $controller->response->setStatusCode(200);
         $controller->response->removeHeader('Location');
     }
 }
开发者ID:hamishcampbell,项目名称:silverstripe-sapphire,代码行数:34,代码来源:SapphireTest.php

示例6: testValidURLSegmentURLSegmentConflicts

 /**
  * @covers SiteTree::validURLSegment
  */
 public function testValidURLSegmentURLSegmentConflicts()
 {
     $sitetree = new SiteTree();
     SiteTree::disable_nested_urls();
     $sitetree->URLSegment = 'home';
     $this->assertFalse($sitetree->validURLSegment(), 'URLSegment conflicts are recognised');
     $sitetree->URLSegment = 'home-noconflict';
     $this->assertTrue($sitetree->validURLSegment());
     $sitetree->ParentID = $this->idFromFixture('Page', 'about');
     $sitetree->URLSegment = 'home';
     $this->assertFalse($sitetree->validURLSegment(), 'Conflicts are still recognised with a ParentID value');
     SiteTree::enable_nested_urls();
     $sitetree->ParentID = 0;
     $sitetree->URLSegment = 'home';
     $this->assertFalse($sitetree->validURLSegment(), 'URLSegment conflicts are recognised');
     $sitetree->ParentID = $this->idFromFixture('Page', 'about');
     $this->assertTrue($sitetree->validURLSegment(), 'URLSegments can be the same across levels');
     $sitetree->URLSegment = 'my-staff';
     $this->assertFalse($sitetree->validURLSegment(), 'Nested URLSegment conflicts are recognised');
     $sitetree->URLSegment = 'my-staff-noconflict';
     $this->assertTrue($sitetree->validURLSegment());
 }
开发者ID:comperio,项目名称:silverstripe-framework,代码行数:25,代码来源:SiteTreeTest.php


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