setUp() public method

public setUp ( )
コード例 #1
0
ファイル: BasicAuthTest.php プロジェクト: normann/sapphire
 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');
 }
 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
0
 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
0
 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
0
	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
0
 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
0
 function setUp()
 {
     parent::setUp();
     $this->logInWithPermission('ADMIN');
     $this->form = new UserDefinedForm();
     $this->form->write();
 }
コード例 #8
0
 function setUp()
 {
     parent::setUp();
     $this->useDraftSite();
     // we're testing HTTP status codes before being redirected to login forms
     $this->autoFollowRedirection = false;
 }
コード例 #9
0
 function setUp()
 {
     parent::setUp();
     // whenever a translation is created, canTranslate() is checked
     $cmseditor = $this->objFromFixture('Member', 'cmseditor');
     $cmseditor->logIn();
 }
コード例 #10
0
ファイル: FormTest.php プロジェクト: aaronleslie/aaronunix
 public function setUp()
 {
     parent::setUp();
     Config::inst()->update('Director', 'rules', array('FormTest_Controller' => 'FormTest_Controller'));
     // Suppress themes
     Config::inst()->remove('SSViewer', 'theme');
 }
コード例 #11
0
 /**
  * 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
0
ファイル: MemberTest.php プロジェクト: nomidi/sapphire
 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);
 }
 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
0
 function setUp()
 {
     parent::setUp();
     // @todo fix controller stack problems and re-activate
     //$this->autoFollowRedirection = false;
     CMSMenu::populate_menu();
 }
コード例 #15
0
 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);
     }
 }
コード例 #16
0
 public function setUp()
 {
     parent::setUp();
     $holderPage = $this->objFromFixture('SiteTree', 'searchformholder');
     $this->mockController = new ContentController($holderPage);
     $this->waitUntilIndexingFinished();
 }
 function setUp()
 {
     parent::setUp();
     $parent1_published = $this->objFromFixture('Page', 'parent1_published');
     $parent1_published->publish('Stage', 'Live');
     $child1_1_published = $this->objFromFixture('Page', 'child1_1_published');
     $child1_1_published->publish('Stage', 'Live');
     $child1_2_published = $this->objFromFixture('Page', 'child1_2_published');
     $child1_2_published->publish('Stage', 'Live');
     $child1_3_orphaned = $this->objFromFixture('Page', 'child1_3_orphaned');
     $child1_3_orphaned->ParentID = 9999;
     $child1_3_orphaned->write();
     $child1_4_orphaned_published = $this->objFromFixture('Page', 'child1_4_orphaned_published');
     $child1_4_orphaned_published->ParentID = 9999;
     $child1_4_orphaned_published->write();
     $child1_4_orphaned_published->publish('Stage', 'Live');
     $grandchild1_1_2_published = $this->objFromFixture('Page', 'grandchild1_1_2_published');
     $grandchild1_1_2_published->publish('Stage', 'Live');
     $grandchild1_1_3_orphaned = $this->objFromFixture('Page', 'grandchild1_1_3_orphaned');
     $grandchild1_1_3_orphaned->ParentID = 9999;
     $grandchild1_1_3_orphaned->write();
     $grandchild1_1_4_orphaned_published = $this->objFromFixture('Page', 'grandchild1_1_4_orphaned_published');
     $grandchild1_1_4_orphaned_published->ParentID = 9999;
     $grandchild1_1_4_orphaned_published->write();
     $grandchild1_1_4_orphaned_published->publish('Stage', 'Live');
     $child2_1_published_orphaned = $this->objFromFixture('Page', 'child2_1_published_orphaned');
     $child2_1_published_orphaned->publish('Stage', 'Live');
 }
コード例 #18
0
 public function setUp()
 {
     parent::setUp();
     $this->defaultToken = Config::inst()->get('TokenAuth', 'DevToken');
     // clear cache
     SS_Cache::factory('rest_cache')->clean(Zend_Cache::CLEANING_MODE_ALL);
 }
 public function setUp()
 {
     parent::setUp();
     Translatable::disable_locale_filter();
     //Publish all english pages
     $pages = Page::get()->filter('Locale', 'en_US');
     foreach ($pages as $page) {
         $page->publish('Stage', 'Live');
     }
     //Rewrite the french translation groups and publish french pages
     $pagesFR = Page::get()->filter('Locale', 'fr_FR');
     foreach ($pagesFR as $index => $page) {
         $page->addTranslationGroup($pages->offsetGet($index)->ID, true);
         $page->publish('Stage', 'Live');
     }
     Translatable::enable_locale_filter();
     $this->origLocaleRoutingEnabled = Config::inst()->get('MultilingualRootURLController', 'UseLocaleURL');
     Config::inst()->update('MultilingualRootURLController', 'UseLocaleURL', false);
     $this->origDashLocaleEnabled = Config::inst()->get('MultilingualRootURLController', 'UseDashLocale');
     Config::inst()->update('MultilingualRootURLController', 'UseDashLocale', false);
     $this->origAcceptLanguage = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
     $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en-US,en;q=0.5';
     $this->origCookieLocale = Cookie::get('language');
     Cookie::force_expiry('language');
     Cookie::set('language', 'en');
     $this->origCurrentLocale = Translatable::get_current_locale();
     Translatable::set_current_locale('en_US');
     $this->origLocale = Translatable::default_locale();
     Translatable::set_default_locale('en_US');
     $this->origi18nLocale = i18n::get_locale();
     i18n::set_locale('en_US');
     $this->origAllowedLocales = Translatable::get_allowed_locales();
     Translatable::set_allowed_locales(array('en_US', 'fr_FR'));
     MultilingualRootURLController::reset();
 }
コード例 #20
0
 public function setUp()
 {
     parent::setUp();
     $this->accountpage = $this->objFromFixture("AccountPage", "accountpage");
     $this->controller = new AccountPage_Controller($this->accountpage);
     $this->controller->init();
 }
 public function setUp()
 {
     parent::setUp();
     //Remap translation group for home pages
     Translatable::disable_locale_filter();
     $default = $this->objFromFixture('Page', 'home');
     $defaultFR = $this->objFromFixture('Page', 'home_fr');
     $defaultFR->addTranslationGroup($default->ID, true);
     Translatable::enable_locale_filter();
     $this->origLocaleRoutingEnabled = Config::inst()->get('MultilingualRootURLController', 'UseLocaleURL');
     Config::inst()->update('MultilingualRootURLController', 'UseLocaleURL', false);
     $this->origDashLocaleEnabled = Config::inst()->get('MultilingualRootURLController', 'UseDashLocale');
     Config::inst()->update('MultilingualRootURLController', 'UseDashLocale', false);
     $this->origAcceptLanguage = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
     $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en-US,en;q=0.5';
     $this->origCookieLocale = Cookie::get('language');
     Cookie::force_expiry('language');
     $this->origCurrentLocale = Translatable::get_current_locale();
     Translatable::set_current_locale('en_US');
     $this->origLocale = Translatable::default_locale();
     Translatable::set_default_locale('en_US');
     $this->origi18nLocale = i18n::get_locale();
     i18n::set_locale('en_US');
     $this->origAllowedLocales = Translatable::get_allowed_locales();
     Translatable::set_allowed_locales(array('en_US', 'fr_FR'));
     MultilingualRootURLController::reset();
 }
コード例 #22
0
 public function setUp()
 {
     parent::setUp();
     $this->loginWithPermission('ADMIN');
     // Save versioned state
     $this->oldReadingMode = Versioned::get_reading_mode();
     Versioned::set_stage(Versioned::DRAFT);
     // Set backend root to /UploadFieldTest
     AssetStoreTest_SpyStore::activate('UploadFieldTest');
     // Set the File Name Filter replacements so files have the expected names
     Config::inst()->update('FileNameFilter', 'default_replacements', array('/\\s/' => '-', '/_/' => '-', '/[^A-Za-z0-9+.\\-]+/' => '', '/[\\-]{2,}/' => '-', '/^[\\.\\-_]+/' => ''));
     // Create a test folders for each of the fixture references
     foreach (Folder::get() as $folder) {
         $path = AssetStoreTest_SpyStore::getLocalPath($folder);
         Filesystem::makeFolder($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);
         Filesystem::makeFolder(dirname($path));
         $fh = fopen($path, "w+");
         fwrite($fh, str_repeat('x', 1000000));
         fclose($fh);
     }
 }
コード例 #23
0
 public function setUp()
 {
     parent::setUp();
     $this->orig['Member_unique_identifier_field'] = Member::config()->unique_identifier_field;
     Member::config()->unique_identifier_field = 'Email';
     Member::set_password_validator(null);
 }
コード例 #24
0
 public function setUp()
 {
     parent::setUp();
     ini_set('display_errors', 1);
     ini_set("log_errors", 1);
     error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
 }
コード例 #25
0
 function setUp()
 {
     // Static publishing will just confuse things
     StaticPublisher::$disable_realtime = true;
     parent::setUp();
     $this->origLocale = i18n::get_locale();
     i18n::set_locale('en_NZ');
 }
コード例 #26
0
 public function setUp()
 {
     parent::setUp();
     Controller::add_extension('ShopTestControllerExtension');
     $this->accountpage = $this->objFromFixture("AccountPage", "accountpage");
     $this->controller = new AccountPage_Controller($this->accountpage);
     $this->controller->init();
 }
 function setUp()
 {
     parent::setUp();
     $this->orig['public_api_key'] = RecaptchaField::$public_api_key;
     $this->orig['public_api_key'] = RecaptchaField::$private_api_key;
     RecaptchaField::$public_api_key = 'test';
     RecaptchaField::$private_api_key = 'test';
 }
コード例 #28
0
	function setUp() {
		parent::setUp();
		
		$blogHolder = $this->objFromFixture('BlogHolder', 'blogholder');
		$blogHolder->publish('Stage', 'Live');
		$blogEntry = $this->objFromFixture('BlogEntry', 'entry1');
		$blogEntry->publish('Stage', 'Live');
	}
コード例 #29
0
 public function setUp()
 {
     parent::setUp();
     $this->list = new DataList('GridFieldTest_Team');
     $config = GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldPaginator(2), new GridFieldPageCount('toolbar-header-right'));
     $this->gridField = new GridField('testfield', 'testfield', $this->list, $config);
     $this->form = new Form(new Controller(), 'mockform', new FieldList(array($this->gridField)), new FieldList());
 }
コード例 #30
0
ファイル: FieldEditorTest.php プロジェクト: vinstah/body
 function setUp()
 {
     parent::setUp();
     $form = $this->objFromFixture('UserDefinedForm', 'basic-form-page');
     $controller = new FieldEditorTest_Controller($form);
     $fields = $controller->Form()->Fields();
     $this->editor = $fields->fieldByName('Fields');
 }