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


PHP Config::nest方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     Config::nest();
     Config::inst()->update('HtmlEditorField_Toolbar', 'fileurl_scheme_whitelist', array('http'));
     Config::inst()->update('HtmlEditorField_Toolbar', 'fileurl_domain_whitelist', array('example.com'));
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:7,代码来源:HtmlEditorFieldToolbarTest.php

示例2: setUp

 public function setUp()
 {
     parent::setUp();
     Config::nest();
     Injector::nest();
     $this->securityWasEnabled = SecurityToken::is_enabled();
     // Check dependencies
     if (!class_exists('Phockito')) {
         $this->skipTest = true;
         return $this->markTestSkipped("These tests need the Phockito module installed to run");
     }
     // Reset config
     Config::inst()->update('SpellController', 'required_permission', 'CMS_ACCESS_CMSMain');
     Config::inst()->remove('SpellController', 'locales');
     Config::inst()->update('SpellController', 'locales', array('en_US', 'en_NZ', 'fr_FR'));
     Config::inst()->update('SpellController', 'enable_security_token', true);
     SecurityToken::enable();
     // Setup mock for testing provider
     $spellChecker = Phockito::mock('SpellProvider');
     Phockito::when($spellChecker)->checkWords('en_NZ', array('collor', 'colour', 'color', 'onee', 'correct'))->return(array('collor', 'color', 'onee'));
     Phockito::when($spellChecker)->checkWords('en_US', array('collor', 'colour', 'color', 'onee', 'correct'))->return(array('collor', 'colour', 'onee'));
     Phockito::when($spellChecker)->getSuggestions('en_NZ', 'collor')->return(array('collar', 'colour'));
     Phockito::when($spellChecker)->getSuggestions('en_US', 'collor')->return(array('collar', 'color'));
     Injector::inst()->registerService($spellChecker, 'SpellProvider');
 }
开发者ID:helpfulrobot,项目名称:silverstripe-spellcheck,代码行数:25,代码来源:SpellControllerTest.php

示例3: testPermissionFailureSetsCorrectFormMessages

 public function testPermissionFailureSetsCorrectFormMessages()
 {
     Config::nest();
     // Controller that doesn't attempt redirections
     $controller = new SecurityTest_NullController();
     $controller->response = new SS_HTTPResponse();
     Security::permissionFailure($controller, array('default' => 'Oops, not allowed'));
     $this->assertEquals('Oops, not allowed', Session::get('Security.Message.message'));
     // Test that config values are used correctly
     Config::inst()->update('Security', 'default_message_set', 'stringvalue');
     Security::permissionFailure($controller);
     $this->assertEquals('stringvalue', Session::get('Security.Message.message'), 'Default permission failure message value was not present');
     Config::inst()->remove('Security', 'default_message_set');
     Config::inst()->update('Security', 'default_message_set', array('default' => 'arrayvalue'));
     Security::permissionFailure($controller);
     $this->assertEquals('arrayvalue', Session::get('Security.Message.message'), 'Default permission failure message value was not present');
     // Test that non-default messages work.
     // NOTE: we inspect the response body here as the session message has already
     // been fetched and output as part of it, so has been removed from the session
     $this->logInWithPermission('EDITOR');
     Config::inst()->update('Security', 'default_message_set', array('default' => 'default', 'alreadyLoggedIn' => 'You are already logged in!'));
     Security::permissionFailure($controller);
     $this->assertContains('You are already logged in!', $controller->response->getBody(), 'Custom permission failure message was ignored');
     Security::permissionFailure($controller, array('default' => 'default', 'alreadyLoggedIn' => 'One-off failure message'));
     $this->assertContains('One-off failure message', $controller->response->getBody(), "Message set passed to Security::permissionFailure() didn't override Config values");
     Config::unnest();
 }
开发者ID:tcaiger,项目名称:mSupplyNZ,代码行数:27,代码来源:SecurityTest.php

示例4: setUp

 public function setUp()
 {
     parent::setUp();
     Config::nest();
     // Two restarts are allowed per job
     Config::inst()->update('QueuedJobService', 'stall_threshold', 2);
 }
开发者ID:tim-lar,项目名称:silverstripe-queuedjobs,代码行数:7,代码来源:QueuedJobsTest.php

示例5: setUp

 public function setUp()
 {
     parent::setUp();
     // Fixtures assume Email is the field used to identify the log in identity
     Config::nest();
     Member::config()->unique_identifier_field = 'Email';
     Member::config()->lock_out_after_incorrect_logins = 10;
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:8,代码来源:BasicAuthTest.php

示例6: setUp

 public function setUp()
 {
     Config::nest();
     parent::setUp();
     Config::inst()->update('Email', 'admin_email', 'no-reply@somewhere.com');
     Config::inst()->update('SuspendSpammerEmail', 'email_to', 'someone@somewhere.com');
     Config::inst()->update('SuspendSpammerEmail', 'enable_email', true);
 }
开发者ID:helpfulrobot,项目名称:camfindlay-silverstripe-suspendspammer,代码行数:8,代码来源:SuspendSpammerTest.php

示例7: setUp

 /**
  * Set up the test
  */
 public function setUp()
 {
     Config::inst()->update('DataObject', 'validation_enabled', false);
     Config::nest();
     parent::setUp();
     $this->page = $this->objFromFixture('SummitVideoApp', 'App');
     $this->page->publish("Stage", "Live");
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:11,代码来源:SummitVideoAppTest.php

示例8: setUp

 public function setUp()
 {
     parent::setUp();
     Config::nest();
     Config::inst()->update('Email', 'admin_email', 'myadmin@mysite.com');
     $this->oldhost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null;
     $_SERVER['HTTP_HOST'] = 'www.mysite.com';
 }
开发者ID:helpfulrobot,项目名称:silverstripe-comment-notifications,代码行数:8,代码来源:CommentNotifiableTest.php

示例9: getCustomerNote

 function getCustomerNote()
 {
     Config::nest();
     Config::inst()->update('SSViewer', 'theme_enabled', true);
     $html = $this->renderWith("LogDispatchPhysicalOrderCustomerNote");
     Config::unnest();
     return $html;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:8,代码来源:OrderStatusLog_DispatchPhysicalOrder.php

示例10: setUpOnce

 public function setUpOnce()
 {
     Config::nest();
     VersionableExtensionsTest_DataObject::add_extension('Versioned');
     VersionableExtensionsTest_DataObject::add_extension('VersionableExtensionsTest_Extension');
     $cfg = Config::inst();
     $cfg->update('VersionableExtensionsTest_DataObject', 'versionableExtensions', array('VersionableExtensionsTest_Extension' => array('test1', 'test2', 'test3')));
     parent::setUpOnce();
 }
开发者ID:assertchris,项目名称:silverstripe-framework,代码行数:9,代码来源:VersionableExtensionsTest.php

示例11: setUp

 public function setUp()
 {
     parent::setUp();
     Config::nest();
     // Set good default values
     Config::inst()->update('CommentsExtension', 'comments', array('enabled' => true, 'enabled_cms' => false, 'require_login' => false, 'require_login_cms' => false, 'required_permission' => false, 'require_moderation_nonmembers' => false, 'require_moderation' => false, 'require_moderation_cms' => false, 'frontend_moderation' => false, 'frontend_spam' => false));
     // Configure this dataobject
     Config::inst()->update('CommentableItem', 'comments', array('enabled_cms' => true));
 }
开发者ID:tcaiger,项目名称:mSupplyNZ,代码行数:9,代码来源:CommentsTest.php

示例12: testCustomGetVar

 function testCustomGetVar()
 {
     Config::nest();
     Config::inst()->update('MultiForm', 'get_var', 'SuperSessionID');
     $form = $this->controller->Form();
     $this->assertContains('SuperSessionID', $form::$ignored_fields, "GET var wasn't added to ignored fields");
     $this->assertContains('SuperSessionID', $form->FormAction(), "Form action doesn't contain correct session \n\t\t\tID parameter");
     $this->assertContains('SuperSessionID', $form->getCurrentStep()->Link(), "Form step doesn't contain correct \n\t\t\tsession ID parameter");
     Config::unnest();
 }
开发者ID:tim-lar,项目名称:silverstripe-multiform,代码行数:10,代码来源:MultiFormTest.php

示例13: forPDF

 /**
  * Render the object using SSViewer
  * @return string
  */
 public function forPDF($variables = array())
 {
     Config::nest();
     Config::inst()->update('Director', 'alternate_base_url', static::get_render_host());
     $file = $this->owner->getPDFTemplate();
     $viewer = new SSViewer($file);
     $output = $viewer->process($this->owner, $variables);
     Config::unnest();
     return $output;
 }
开发者ID:betterbrief,项目名称:silverstripe-pdf,代码行数:14,代码来源:PDFExtension.php

示例14: setUp

 public function setUp()
 {
     parent::setUp();
     // Fixtures assume Email is the field used to identify the log in identity
     Config::nest();
     Member::config()->unique_identifier_field = 'Email';
     Security::$force_database_is_ready = true;
     // Prevents Member test subclasses breaking ready test
     Member::config()->lock_out_after_incorrect_logins = 10;
 }
开发者ID:nicocin,项目名称:silverstripe-framework,代码行数:10,代码来源:BasicAuthTest.php

示例15: testTruncatesByMaxLength

 public function testTruncatesByMaxLength()
 {
     Config::nest();
     Config::inst()->update('FileTextCache_Database', 'max_content_length', 5);
     $cache = new FileTextCache_Database();
     $file = $this->getMock('File', array('write'));
     $content = '0123456789';
     $cache->save($file, $content);
     $this->assertEquals($cache->load($file), '01234');
     Config::unnest();
 }
开发者ID:helpfulrobot,项目名称:silverstripe-textextraction,代码行数:11,代码来源:FileTextCacheDatabaseTest.php


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