public function setUp()
 {
     parent::setUp();
     $this->base = dirname(__FILE__) . '/fixtures/namespaced_classmanifest';
     $this->manifest = new ClassManifest($this->base, false, true, false);
     ClassLoader::instance()->pushManifest($this->manifest, false);
 }
 public function setUp()
 {
     parent::setUp();
     // Set backend
     AssetStoreTest_SpyStore::activate('DBFileTest');
     Config::inst()->update('SilverStripe\\Control\\Director', 'alternate_base_url', '/mysite/');
 }
 public function setUp()
 {
     parent::setUp();
     self::$originalVersionInfo = Deprecation::dump_settings();
     Deprecation::$notice_level = E_USER_NOTICE;
     Deprecation::set_enabled(true);
 }
 public function setUp()
 {
     parent::setUp();
     $this->base = dirname(__FILE__) . '/fixtures/classmanifest';
     $this->manifest = new ClassManifest($this->base, false, true, false);
     $this->manifestTests = new ClassManifest($this->base, true, true, false);
 }
 public function setUp()
 {
     // Set timezone to support timestamp->date conversion.
     $this->originalTZ = date_default_timezone_get();
     date_default_timezone_set('Pacific/Auckland');
     parent::setUp();
 }
 public function setUp()
 {
     parent::setUp();
     // Set backend and base url
     Versioned::set_stage(Versioned::DRAFT);
     AssetStoreTest_SpyStore::activate('AssetControlExtensionTest');
     $this->logInWithPermission('ADMIN');
     // Setup fixture manually
     $object1 = new AssetControlExtensionTest_VersionedObject();
     $object1->Title = 'My object';
     $fish1 = realpath(__DIR__ . '/../model/testimages/test-image-high-quality.jpg');
     $object1->Header->setFromLocalFile($fish1, 'Header/MyObjectHeader.jpg');
     $object1->Download->setFromString('file content', 'Documents/File.txt');
     $object1->write();
     $object1->publishSingle();
     $object2 = new AssetControlExtensionTest_Object();
     $object2->Title = 'Unversioned';
     $object2->Image->setFromLocalFile($fish1, 'Images/BeautifulFish.jpg');
     $object2->write();
     $object3 = new AssetControlExtensionTest_ArchivedObject();
     $object3->Title = 'Archived';
     $object3->Header->setFromLocalFile($fish1, 'Archived/MyObjectHeader.jpg');
     $object3->write();
     $object3->publishSingle();
 }
 public function setUp()
 {
     parent::setUp();
     // Set test handler
     ShortcodeParser::get('htmltest')->register('test_shortcode', array('DBHTMLTextTest_Shortcode', 'handle_shortcode'));
     ShortcodeParser::set_active('htmltest');
 }
 public function setUp()
 {
     parent::setUp();
     $this->list = new DataList('GridFieldExportButtonTest_Team');
     $this->list = $this->list->sort('Name');
     $config = GridFieldConfig::create()->addComponent(new GridFieldExportButton());
     $this->gridField = new GridField('testfield', 'testfield', $this->list, $config);
 }
 public function setUp()
 {
     parent::setUp();
     $this->originalLocale = i18n::get_locale();
     i18n::set_locale('en_NZ');
     $this->origTimeConfig = Config::inst()->get('SilverStripe\\Forms\\TimeField', 'default_config');
     Config::inst()->update('SilverStripe\\Forms\\TimeField', 'default_config', array('timeformat' => 'HH:mm:ss'));
 }
 public function setUp()
 {
     parent::setUp();
     $this->baseManifest1 = dirname(__FILE__) . '/fixtures/classmanifest';
     $this->baseManifest2 = dirname(__FILE__) . '/fixtures/classmanifest_other';
     $this->testManifest1 = new ClassManifest($this->baseManifest1, false, true, false);
     $this->testManifest2 = new ClassManifest($this->baseManifest2, false, true, false);
 }
 public function setUp()
 {
     parent::setUp();
     $this->defaultUsername = Security::default_admin_username();
     $this->defaultPassword = Security::default_admin_password();
     Security::clear_default_admin();
     Security::setDefaultAdmin('admin', 'password');
 }
 public function setUp()
 {
     parent::setUp();
     SSViewer::config()->update('source_file_comments', false);
     SSViewer_FromString::config()->update('cache_template', false);
     AssetStoreTest_SpyStore::activate('SSViewerTest');
     $this->oldServer = $_SERVER;
 }
 public function setUp()
 {
     parent::setUp();
     $this->originalLocale = i18n::get_locale();
     i18n::set_locale('en_NZ');
     $this->origConfig = Config::inst()->get('SilverStripe\\Forms\\DateField', 'default_config');
     Config::inst()->update('SilverStripe\\Forms\\DateField', 'default_config', array('dateformat' => 'dd/MM/yyyy'));
 }
 public function setUp()
 {
     parent::setUp();
     $this->rootDir = ASSETS_PATH . '/AssetAdapterTest';
     Filesystem::makeFolder($this->rootDir);
     Config::inst()->update('SilverStripe\\Control\\Director', 'alternate_base_url', '/');
     $this->originalServer = $_SERVER;
 }
 public function setUp()
 {
     parent::setUp();
     $this->list = new DataList('GridFieldAction_Edit_Team');
     $config = GridFieldConfig::create()->addComponent(new GridFieldEditButton());
     $this->gridField = new GridField('testfield', 'testfield', $this->list, $config);
     $this->form = new Form(new Controller(), 'mockform', new FieldList(array($this->gridField)), new FieldList());
 }
 public function setUp()
 {
     parent::setUp();
     // 42 items
     for ($i = 1; $i <= 42; $i++) {
         $obj = new GridFieldPrintButtonTest_DO();
         $obj->Name = "Object {$i}";
         $obj->write();
     }
 }
 function setUp()
 {
     // Check we can run PHP at all
     $null = is_writeable('/dev/null') ? '/dev/null' : 'NUL';
     exec("php -v 2> {$null}", $out, $rv);
     if ($rv != 0) {
         $this->markTestSkipped("Can't run PHP from the command line - is it in your path?");
     }
     parent::setUp();
 }
 /**
  * Set up manifest before each test
  */
 public function setUp()
 {
     parent::setUp();
     // Fake project root
     $this->base = dirname(__FILE__) . '/fixtures/templatemanifest';
     // New ThemeManifest for that root
     $this->manifest = new ThemeManifest($this->base, 'myproject', false, true);
     // New Loader for that root
     $this->loader = new ThemeResourceLoader($this->base);
     $this->loader->addSet('$default', $this->manifest);
 }
 public function setUp()
 {
     parent::setUp();
     Config::inst()->update('SilverStripe\\Control\\Director', 'alternate_base_url', '/');
     if (!self::$original_host) {
         self::$original_host = $_SERVER['HTTP_HOST'];
     }
     $_SERVER['HTTP_HOST'] = 'www.example.org';
     ShortcodeParser::get('default')->register('test_shortcode', function () {
         return 'test shortcode output';
     });
 }
 public function setUp()
 {
     parent::setUp();
     $this->oldHost = $_SERVER['HTTP_HOST'];
     $_GET['parameterconfirmationtokentest_notoken'] = 'value';
     $_GET['parameterconfirmationtokentest_empty'] = '';
     $_GET['parameterconfirmationtokentest_withtoken'] = '1';
     $_GET['parameterconfirmationtokentest_withtokentoken'] = 'dummy';
     $_GET['parameterconfirmationtokentest_nulltoken'] = '1';
     $_GET['parameterconfirmationtokentest_nulltokentoken'] = null;
     $_GET['parameterconfirmationtokentest_emptytoken'] = '1';
     $_GET['parameterconfirmationtokentest_emptytokentoken'] = '';
 }
 public function setUp()
 {
     parent::setUp();
     $this->alternateBasePath = $this->getCurrentAbsolutePath() . "/_fakewebroot";
     Config::inst()->update('SilverStripe\\Control\\Director', 'alternate_base_folder', $this->alternateBasePath);
     $this->alternateBaseSavePath = TEMP_FOLDER . '/i18nTextCollectorTest_webroot';
     Filesystem::makeFolder($this->alternateBaseSavePath);
     // Push a class and template loader running from the fake webroot onto
     // the stack.
     $this->manifest = new ClassManifest($this->alternateBasePath, false, true, false);
     // Replace old template loader with new one with alternate base path
     $this->_oldLoader = ThemeResourceLoader::instance();
     ThemeResourceLoader::set_instance(new ThemeResourceLoader($this->alternateBasePath));
 }
 public function setUp()
 {
     parent::setUp();
     // TODO Workaround to force database clearing with no fixture present,
     // and avoid sideeffects from other tests
     if (!self::using_temp_db()) {
         self::create_temp_db();
     }
     self::empty_temp_db();
     $this->defaultUsername = Security::default_admin_username();
     $this->defaultPassword = Security::default_admin_password();
     Security::clear_default_admin();
     Security::setDefaultAdmin('admin', 'password');
     Permission::flush_permission_cache();
 }
 public function setUp()
 {
     parent::setUp();
     Versioned::set_stage(Versioned::DRAFT);
     // Automatically publish any object named *_published
     foreach ($this->getFixtureFactory()->getFixtures() as $class => $fixtures) {
         foreach ($fixtures as $name => $id) {
             if (stripos($name, '_published') !== false) {
                 /** @var Versioned|DataObject $object */
                 $object = DataObject::get($class)->byID($id);
                 $object->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
             }
         }
     }
 }
 public function setUp()
 {
     parent::setUp();
     Versioned::set_stage(Versioned::DRAFT);
     // Set backend root to /DataDifferencerTest
     AssetStoreTest_SpyStore::activate('DataDifferencerTest');
     // Create a test files for each of the fixture references
     $files = File::get()->exclude('ClassName', 'SilverStripe\\Assets\\Folder');
     foreach ($files as $file) {
         $fromPath = FRAMEWORK_PATH . '/tests/model/testimages/' . $file->Name;
         $destPath = AssetStoreTest_SpyStore::getLocalPath($file);
         // Only correct for test asset store
         Filesystem::makeFolder(dirname($destPath));
         copy($fromPath, $destPath);
     }
 }
 public function setUp()
 {
     parent::setUp();
     HTMLEditorField_Toolbar::config()->update('fileurl_scheme_whitelist', array('http'));
     HTMLEditorField_Toolbar::config()->update('fileurl_domain_whitelist', array('example.com'));
     // Filesystem mock
     AssetStoreTest_SpyStore::activate(__CLASS__);
     // Load up files
     /** @var File $file1 */
     $file1 = $this->objFromFixture('SilverStripe\\Assets\\File', 'example_file');
     $file1->setFromString(str_repeat('x', 1000), $file1->Name);
     $file1->write();
     /** @var Image $image1 */
     $image1 = $this->objFromFixture('SilverStripe\\Assets\\Image', 'example_image');
     $image1->setFromLocalFile(__DIR__ . '/images/HTMLEditorFieldTest-example.jpg', 'folder/subfolder/HTMLEditorFieldTest_example.jpg');
     $image1->write();
 }
 public function setUp()
 {
     parent::setUp();
     // Hold the original request URI once so it doesn't get overwritten
     if (!self::$originalRequestURI) {
         self::$originalRequestURI = $_SERVER['REQUEST_URI'];
     }
     $_SERVER['REQUEST_URI'] = 'http://www.mysite.com';
     $this->originalGet = $_GET;
     $this->originalSession = $_SESSION;
     $_SESSION = array();
     Config::inst()->update('SilverStripe\\Control\\Director', 'rules', array('DirectorTestRule/$Action/$ID/$OtherID' => 'DirectorTestRequest_Controller', 'en-nz/$Action/$ID/$OtherID' => array('Controller' => 'DirectorTestRequest_Controller', 'Locale' => 'en_NZ')));
     $headers = array('HTTP_X_FORWARDED_PROTOCOL', 'HTTPS', 'SSL');
     foreach ($headers as $header) {
         if (isset($_SERVER[$header])) {
             $this->originalProtocolHeaders[$header] = $_SERVER[$header];
         }
     }
     Config::inst()->update('SilverStripe\\Control\\Director', 'alternate_base_url', '/');
 }
 public function setUp()
 {
     // Skip calling FunctionalTest directly.
     if (get_class($this) == __CLASS__) {
         $this->markTestSkipped(sprintf('Skipping %s ', get_class($this)));
     }
     parent::setUp();
     $this->mainSession = new TestSession();
     // Disable theme, if necessary
     if (static::get_disable_themes()) {
         SSViewer::config()->update('theme_enabled', false);
     }
     // Switch to draft site, if necessary
     if (static::get_use_draft_site()) {
         $this->useDraftSite();
     }
     // Unprotect the site, tests are running with the assumption it's off. They will enable it on a case-by-case
     // basis.
     BasicAuth::protect_entire_site(false);
     SecurityToken::disable();
 }
 public function setUp()
 {
     parent::setUp();
     // Execute specific subclass
     if (get_class($this) == "ImageTest") {
         $this->markTestSkipped(sprintf('Skipping %s ', get_class($this)));
         return;
     }
     // Set backend root to /ImageTest
     AssetStoreTest_SpyStore::activate('ImageTest');
     // Copy test images for each of the fixture references
     $files = File::get()->exclude('ClassName', 'SilverStripe\\Assets\\Folder');
     foreach ($files as $image) {
         $filePath = AssetStoreTest_SpyStore::getLocalPath($image);
         // Only correct for test asset store
         $sourcePath = FRAMEWORK_PATH . '/tests/model/testimages/' . $image->Name;
         if (!file_exists($filePath)) {
             SSFilesystem::makeFolder(dirname($filePath));
             if (!copy($sourcePath, $filePath)) {
                 user_error('Failed to copy test images', E_USER_ERROR);
             }
         }
     }
 }
 public function setUp()
 {
     parent::setUp();
     $this->logInWithPermission('ADMIN');
     Versioned::set_stage(Versioned::DRAFT);
     // Set backend root to /ImageTest
     AssetStoreTest_SpyStore::activate('FileTest');
     // Create a test folders for each of the fixture references
     $folderIDs = $this->allFixtureIDs('SilverStripe\\Assets\\Folder');
     foreach ($folderIDs as $folderID) {
         $folder = DataObject::get_by_id('SilverStripe\\Assets\\Folder', $folderID);
         $filePath = ASSETS_PATH . '/FileTest/' . $folder->getFilename();
         Filesystem::makeFolder($filePath);
     }
     // Create a test files for each of the fixture references
     $fileIDs = $this->allFixtureIDs('SilverStripe\\Assets\\File');
     foreach ($fileIDs as $fileID) {
         /** @var File $file */
         $file = DataObject::get_by_id('SilverStripe\\Assets\\File', $fileID);
         $root = ASSETS_PATH . '/FileTest/';
         if ($folder = $file->Parent()) {
             $root .= $folder->getFilename();
         }
         $path = $root . substr($file->getHash(), 0, 10) . '/' . basename($file->getFilename());
         Filesystem::makeFolder(dirname($path));
         $fh = fopen($path, "w+");
         fwrite($fh, str_repeat('x', 1000000));
         fclose($fh);
     }
     // Conditional fixture creation in case the 'cms' module is installed
     if (class_exists('SilverStripe\\CMS\\Model\\ErrorPage')) {
         $page = new ErrorPage(array('Title' => 'Page not Found', 'ErrorCode' => 404));
         $page->write();
         $page->copyVersionToStage('Stage', 'Live');
     }
 }
 public function setUp()
 {
     parent::setUp();
     $this->logInWithPermission('ADMIN');
     Versioned::set_stage(Versioned::DRAFT);
     // Set backend root to /FolderTest
     AssetStoreTest_SpyStore::activate('FolderTest');
     // Set the File Name Filter replacements so files have the expected names
     Config::inst()->update('SilverStripe\\Assets\\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', 'SilverStripe\\Assets\\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);
     }
 }