本文整理汇总了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'));
}
示例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');
}
示例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();
}
示例4: setUp
public function setUp()
{
parent::setUp();
Config::nest();
// Two restarts are allowed per job
Config::inst()->update('QueuedJobService', 'stall_threshold', 2);
}
示例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;
}
示例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);
}
示例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");
}
示例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';
}
示例9: getCustomerNote
function getCustomerNote()
{
Config::nest();
Config::inst()->update('SSViewer', 'theme_enabled', true);
$html = $this->renderWith("LogDispatchPhysicalOrderCustomerNote");
Config::unnest();
return $html;
}
示例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();
}
示例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));
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}