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


PHP Subsite::strict_subdomain_matching方法代码示例

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


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

示例1: tearDown

 public function tearDown()
 {
     parent::tearDown();
     Subsite::$strict_subdomain_matching = $this->origStrictSubdomainMatching;
 }
开发者ID:titledk,项目名称:silverstripe-uploaddirrules,代码行数:5,代码来源:SubsiteUploadDirRulesTest.php

示例2: testStrictSubdomainMatching

 function testStrictSubdomainMatching()
 {
     // Clear existing fixtures
     foreach (DataObject::get('Subsite') as $subsite) {
         $subsite->delete();
     }
     foreach (DataObject::get('SubsiteDomain') as $domain) {
         $domain->delete();
     }
     // Much more expressive than YML in this case
     $subsite1 = $this->createSubsiteWithDomains(array('example.org' => true, 'example.com' => false, '*.wildcard.com' => false));
     $subsite2 = $this->createSubsiteWithDomains(array('www.example.org' => true, 'www.wildcard.com' => false));
     Subsite::$strict_subdomain_matching = false;
     $this->assertEquals($subsite1->ID, Subsite::getSubsiteIDForDomain('example.org'), 'Exact matches without strict checking when not using www prefix');
     $this->assertEquals($subsite1->ID, Subsite::getSubsiteIDForDomain('www.example.org'), 'Matches without strict checking when using www prefix, still matching first domain regardless of www prefix  (falling back to subsite primary key ordering)');
     $this->assertEquals($subsite1->ID, Subsite::getSubsiteIDForDomain('www.example.com'), 'Fuzzy matches without strict checking with www prefix');
     $this->assertEquals(0, Subsite::getSubsiteIDForDomain('www.wildcard.com'), 'Doesn\'t match www prefix without strict check, even if a wildcard subdomain is in place');
     Subsite::$strict_subdomain_matching = true;
     $this->assertEquals($subsite1->ID, Subsite::getSubsiteIDForDomain('example.org'), 'Matches with strict checking when not using www prefix');
     $this->assertEquals($subsite2->ID, Subsite::getSubsiteIDForDomain('www.example.org'), 'Matches with strict checking when using www prefix');
     $this->assertEquals(0, Subsite::getSubsiteIDForDomain('www.example.com'), 'Doesn\'t fuzzy match with strict checking when using www prefix');
     $failed = false;
     try {
         Subsite::getSubsiteIDForDomain('www.wildcard.com');
     } catch (UnexpectedValueException $e) {
         $failed = true;
     }
     $this->assertTrue($failed, 'Fails on multiple matches with strict checking and wildcard vs. www');
 }
开发者ID:helpfulrobot,项目名称:mikenz-silverstripe-simplesubsites,代码行数:29,代码来源:SubsiteTest.php


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