本文整理汇总了PHP中FunctionalTest::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP FunctionalTest::setUp方法的具体用法?PHP FunctionalTest::setUp怎么用?PHP FunctionalTest::setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionalTest
的用法示例。
在下文中一共展示了FunctionalTest::setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
// Fixtures assume Email is the field used to identify the log in identity
self::$original_unique_identifier_field = Member::get_unique_identifier_field();
Member::set_unique_identifier_field('Email');
}
示例2: setUp
public function setUp()
{
parent::setUp();
SocialQueue::queueURL($this->testURL);
// now setup a statistics for the URL
foreach ($this->services as $service) {
$countService = new $service();
if (is_array($countService->statistic)) {
foreach ($countService->statistic as $statistic) {
$stat = URLStatistics::create();
$stat->Service = $countService->service;
$stat->Action = $statistic;
$stat->Count = 50;
$stat->URL = $this->testURL;
$stat->write();
}
} else {
$stat = URLStatistics::create();
$stat->Service = $countService->service;
$stat->Action = $countService->statistic;
$stat->Count = 50;
$stat->URL = $this->testURL;
$stat->write();
unset($stat);
}
}
}
示例3: setUp
function setUp()
{
parent::setUp();
/*
// Set the modifiers to test
Order::set_modifiers(array(
'SimpleShippingModifier',
'TaxModifier'
));
// Set the tax configuration on a per-country basis to test
TaxModifier::set_for_country('NZ', 0.125, 'GST', 'inclusive');
TaxModifier::set_for_country('UK', 0.175, 'VAT', 'exclusive');
// Let's check that we have the Payment module installed properly
$this->assertTrue(class_exists('Payment'), 'Payment module is installed.');
// Set the site currency to NZD - this updates all the pricing labels from USD to NZD
Payment::set_site_currency('NZD');
// Set up the simple shipping calculator to test
SimpleShippingModifier::set_default_charge(10);
SimpleShippingModifier::set_charges_for_countries(array(
'NZ' => 5,
'UK' => 20
));
*/
}
示例4: 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');
}
示例5: setUp
function setUp() {
parent::setUp();
$this->loginWithPermission('ADMIN');
// creates a series of published, unpublished versions of a page
$this->page = new Page();
$this->page->URLSegment = "test";
$this->page->Content = "new content";
$this->page->write();
$this->versionUnpublishedCheck = $this->page->Version;
$this->page->Content = "some further content";
$this->page->write();
$this->page->publish('Stage', 'Live');
$this->versionPublishCheck = $this->page->Version;
$this->page->Content = "No, more changes please";
$this->page->Title = "Changing titles too";
$this->page->write();
$this->versionUnpublishedCheck2 = $this->page->Version;
$this->page->Title = "Final Change";
$this->page->write();
$this->page->publish('Stage', 'Live');
$this->versionPublishCheck2 = $this->page->Version;
}
示例6: setUp
public function setUp()
{
parent::setUp();
// Fixtures assume Email is the field used to identify the log in identity
Member::config()->unique_identifier_field = 'Email';
Member::config()->lock_out_after_incorrect_logins = 10;
}
示例7: setUp
function setUp()
{
parent::setUp();
$this->logInWithPermission('ADMIN');
$this->form = new UserDefinedForm();
$this->form->write();
}
示例8: setUp
function setUp()
{
parent::setUp();
$this->useDraftSite();
// we're testing HTTP status codes before being redirected to login forms
$this->autoFollowRedirection = false;
}
示例9: setUp
function setUp()
{
parent::setUp();
// whenever a translation is created, canTranslate() is checked
$cmseditor = $this->objFromFixture('Member', 'cmseditor');
$cmseditor->logIn();
}
示例10: setUp
public function setUp()
{
parent::setUp();
Config::inst()->update('Director', 'rules', array('FormTest_Controller' => 'FormTest_Controller'));
// Suppress themes
Config::inst()->remove('SSViewer', 'theme');
}
示例11: setUp
/**
* Test setting pagination properties and returning the object
*/
public function setUp()
{
parent::setUp();
$page = new SiteTree(['Title' => "Test Page", 'URLSegment' => 'test']);
$page->write();
$page->publish('Stage', 'Live');
}
示例12: setUp
function setUp()
{
parent::setUp();
$this->orig['Member_unique_identifier_field'] = Member::get_unique_identifier_field();
Member::set_unique_identifier_field('Email');
Member::set_password_validator(null);
}
示例13: setUp
function setUp()
{
self::$fixture_file = MODULE_SECUREFILES_PATH . '/tests/SecureFileControllerTest.yml';
parent::setUp();
$this->priorAuthenticators = Authenticator::get_authenticators();
$this->priorDefaultAuthenticator = Authenticator::get_default_authenticator();
Authenticator::register('MemberAuthenticator');
Authenticator::set_default_authenticator('MemberAuthenticator');
if (!file_exists(ASSETS_PATH)) {
mkdir(ASSETS_PATH);
}
/* Create a test folders for each of the fixture references */
$fileIDs = $this->allFixtureIDs('Folder');
foreach ($fileIDs as $fileID) {
$file = DataObject::get_by_id('Folder', $fileID);
if (!file_exists(BASE_PATH . "/{$file->Filename}")) {
mkdir(BASE_PATH . "/{$file->Filename}");
}
}
/* Create a test files for each of the fixture references */
$fileIDs = $this->allFixtureIDs('File');
foreach ($fileIDs as $fileID) {
$file = DataObject::get_by_id('File', $fileID);
$fh = fopen(BASE_PATH . "/{$file->Filename}", "w");
fwrite($fh, str_repeat('x', 1000));
fclose($fh);
}
// USERS:
// 1 x ADMIN user
// 1 x Member with SECUREFILEACCESS
// 1 x Member with SECURE_FILE_SETTINGS
// 1 x Member
}
示例14: setUp
function setUp()
{
parent::setUp();
// @todo fix controller stack problems and re-activate
//$this->autoFollowRedirection = false;
CMSMenu::populate_menu();
}
示例15: setUp
public function setUp()
{
parent::setUp();
$this->logInWithPermission('ADMIN');
Versioned::reading_stage('Stage');
// Set backend root to /AssetFieldTest
AssetStoreTest_SpyStore::activate('AssetFieldTest');
$create = function ($path) {
Filesystem::makeFolder(dirname($path));
$fh = fopen($path, "w+");
fwrite($fh, str_repeat('x', 1000000));
fclose($fh);
};
// Write all DBFile references
foreach (AssetFieldTest_Object::get() as $object) {
$path = AssetStoreTest_SpyStore::getLocalPath($object->File);
$create($path);
}
// Create a test files for each of the fixture references
$files = File::get()->exclude('ClassName', 'Folder');
foreach ($files as $file) {
$path = AssetStoreTest_SpyStore::getLocalPath($file);
$create($path);
}
}