當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。