Permalink
Browse files

MINOR #6090 FilesystemPublisherTest now stores temporary files in ass…

…ets, which is writable, instead of the webroot which almost never has write permissions (from r111883)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@112810 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 83561f2 commit a91726e0aadfb3b9d6482b0a3b8edc56ca76114c @sminnee sminnee committed Oct 19, 2010
Showing with 16 additions and 2 deletions.
  1. +16 −2 tests/FilesystemPublisherTest.php
@@ -14,17 +14,31 @@ class FilesystemPublisherTest extends SapphireTest {
function setUp() {
parent::setUp();
- Object::add_extension("SiteTree", "FilesystemPublisher('../FilesystemPublisherTest-static-folder/')");
+ Object::add_extension("SiteTree", "FilesystemPublisher('assets/FilesystemPublisherTest-static-folder/')");
SiteTree::$write_homepage_map = false;
$this->orig['domain_based_caching'] = FilesystemPublisher::$domain_based_caching;
FilesystemPublisher::$domain_based_caching = false;
}
function tearDown() {
- Object::remove_extension("SiteTree", "FilesystemPublisher('../FilesystemPublisherTest-static-folder/')");
+ Object::remove_extension("SiteTree", "FilesystemPublisher('assets/FilesystemPublisherTest-static-folder/')");
SiteTree::$write_homepage_map = true;
+ $basePath = '../assets/FilesystemPublisherTest-static-folder';
+ if(file_exists($basePath)) {
+ $dir = opendir($basePath);;
+ while($file = readdir($dir)) {
+ $path = Director::baseFolder() . '/assets/FilesystemPublisherTest-static-folder/' . $file;
+ if(is_dir($path)) continue;
+ else {
+ unlink($path);
+ }
+ }
+ closedir($dir);
+ rmdir($basePath);
+ }
+
FilesystemPublisher::$domain_based_caching = $this->orig['domain_based_caching'];
parent::tearDown();

0 comments on commit a91726e

Please sign in to comment.