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


PHP FunctionalTest::setUp方法代码示例

本文整理汇总了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');
 }
开发者ID:normann,项目名称:sapphire,代码行数:7,代码来源:BasicAuthTest.php

示例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);
         }
     }
 }
开发者ID:helpfulrobot,项目名称:marketo-silverstripe-social-proof,代码行数:27,代码来源:SocialControllerTest.php

示例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
     ));
     */
 }
开发者ID:riddler7,项目名称:silverstripe-ecommerce,代码行数:28,代码来源:OrderModifierTest.php

示例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');
 }
开发者ID:helpfulrobot,项目名称:silverstripe-spellcheck,代码行数:25,代码来源:SpellControllerTest.php

示例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;
	}
开发者ID:redema,项目名称:silverstripe-cms,代码行数:27,代码来源:CMSPageHistoryControllerTest.php

示例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;
 }
开发者ID:maent45,项目名称:redefine_renos,代码行数:7,代码来源:BasicAuthTest.php

示例7: setUp

 function setUp()
 {
     parent::setUp();
     $this->logInWithPermission('ADMIN');
     $this->form = new UserDefinedForm();
     $this->form->write();
 }
开发者ID:nicmart,项目名称:comperio-site,代码行数:7,代码来源:UserDefinedFormEditorTest.php

示例8: setUp

 function setUp()
 {
     parent::setUp();
     $this->useDraftSite();
     // we're testing HTTP status codes before being redirected to login forms
     $this->autoFollowRedirection = false;
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:7,代码来源:SiteTreePermissionsTest.php

示例9: setUp

 function setUp()
 {
     parent::setUp();
     // whenever a translation is created, canTranslate() is checked
     $cmseditor = $this->objFromFixture('Member', 'cmseditor');
     $cmseditor->logIn();
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:7,代码来源:TranslatableTest.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     Config::inst()->update('Director', 'rules', array('FormTest_Controller' => 'FormTest_Controller'));
     // Suppress themes
     Config::inst()->remove('SSViewer', 'theme');
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:7,代码来源:FormTest.php

示例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');
 }
开发者ID:Cyber-Duck,项目名称:Silverstripe-SEO,代码行数:10,代码来源:SEOPaginationTest.php

示例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);
 }
开发者ID:nomidi,项目名称:sapphire,代码行数:7,代码来源:MemberTest.php

示例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
 }
开发者ID:hamishcampbell,项目名称:silverstripe-securefiles,代码行数:33,代码来源:SecureFileControllerTest.php

示例14: setUp

 function setUp()
 {
     parent::setUp();
     // @todo fix controller stack problems and re-activate
     //$this->autoFollowRedirection = false;
     CMSMenu::populate_menu();
 }
开发者ID:rodneyway,项目名称:silverstripe-cms,代码行数:7,代码来源:LeftAndMainTest.php

示例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);
     }
 }
开发者ID:assertchris,项目名称:silverstripe-framework,代码行数:25,代码来源:AssetFieldTest.php


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