public function testEnableWithCustomClasses()
 {
     FulltextSearchable::enable(array('File'));
     $this->assertTrue(File::has_extension('FulltextSearchable'));
     File::remove_extension('FulltextSearchable');
     $this->assertFalse(File::has_extension('FulltextSearchable'));
 }
 public function testCanDownloadRestrictivePermission()
 {
     File::add_extension('SecureFileExtensionTest_RestrictiveFileExtension');
     $oldAFR = $this->autoFollowRedirection;
     $this->autoFollowRedirection = false;
     $file = $this->objFromFixture('File', 'restrictive');
     $content = $this->get($file->Filename);
     // This file lets anyone access it, but our extension should override
     $this->assertTrue($content->getStatusCode() === 302);
     // Should redirect to Security/login
     $this->assertContains('Security/login', $content->getHeader('Location'));
     $this->autoFollowRedirection = $oldAFR;
     File::remove_extension('SecureFileExtensionTest_RestrictiveFileExtension');
 }
 /**
  * FulltextSearchable::enable() leaves behind remains that don't get cleaned up
  * properly at the end of the test. This becomes apparent when a later test tries to
  * ALTER TABLE File and add fulltext indexes with the InnoDB table type.
  */
 public function tearDownOnce()
 {
     parent::tearDownOnce();
     Config::inst()->update('File', 'create_table_options', array('MySQLDatabase' => 'ENGINE=InnoDB'));
     File::remove_extension('FulltextSearchable');
 }
<?php

File::remove_extension('FileSubsites');
File::add_extension('SubsiteFileExtension');
<?php

/**
 * 
 * @author Deviate Ltd 2014-2015 http://www.deviate.net.nz
 * @package silverstripe-advancedassets
 */
define("SECURED_FILES_MODULE_NAME", "Advanced Assets");
define("SECURED_FILES_MODULE_DIR", "silverstripe-advancedassets");
define("SECURED_FILES_ASSET_SUBDIR", "_securedfiles");
if (!file_exists(BASE_PATH . DIRECTORY_SEPARATOR . SECURED_FILES_MODULE_DIR)) {
    $msg = "Module directory seems to be named incorrectly." . " The " . SECURED_FILES_MODULE_NAME . " module" . " should be installed into a folder named " . SECURED_FILES_MODULE_DIR;
    user_error($msg);
}
// Overload use of default {@link AssetAdmin} with the module's own {@link NonSecuredAssetAdmin}.
Object::useCustomClass('AssetAdmin', 'NonSecuredAssetAdmin', true);
CMSMenu::remove_menu_item('AssetAdmin');
CMSMenu::remove_menu_item('CMSSecuredFileAddController');
CMSMenu::remove_menu_item('CMSNonSecuredFileAddController');
// "Obliterate" the securedfiles' SecureFileExtension class.
if (class_exists('SecureFileExtension')) {
    File::remove_extension("SecureFileExtension");
}