2009-12-01 11:26:08 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests for the core of sapphire, such as how the temporary
|
|
|
|
* directory is determined throughout the framework.
|
|
|
|
*
|
|
|
|
* @package sapphire
|
|
|
|
* @subpackage tests
|
|
|
|
*/
|
|
|
|
class CoreTest extends SapphireTest {
|
|
|
|
|
2009-12-01 11:42:38 +01:00
|
|
|
protected $tempPath;
|
2009-12-01 11:26:08 +01:00
|
|
|
|
|
|
|
public function setUp() {
|
|
|
|
parent::setUp();
|
|
|
|
$this->tempPath = $tempPath = Director::baseFolder() . '/silverstripe-cache';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetTempPathInProject() {
|
2009-12-01 11:42:38 +01:00
|
|
|
if(file_exists($this->tempPath)) {
|
|
|
|
$this->assertEquals(getTempFolder(), $this->tempPath);
|
|
|
|
} else {
|
|
|
|
// A typical Windows location for where sites are stored on IIS
|
2010-01-28 06:52:38 +01:00
|
|
|
$this->assertEquals(getTempFolder('C:\\inetpub\\wwwroot\\silverstripe'), getSysTempDir() . '/silverstripe-cacheC--inetpub-wwwroot-silverstripe');
|
2009-12-01 11:42:38 +01:00
|
|
|
|
|
|
|
// A typical Mac OS X location for where sites are stored
|
2010-01-28 06:52:38 +01:00
|
|
|
$this->assertEquals(getTempFolder('/Users/joebloggs/Sites/silverstripe'), getSysTempDir() . '/silverstripe-cache-Users-joebloggs-Sites-silverstripe');
|
2009-12-01 11:42:38 +01:00
|
|
|
|
|
|
|
// A typical Linux location for where sites are stored
|
2010-01-28 06:52:38 +01:00
|
|
|
$this->assertEquals(getTempFolder('/var/www/silverstripe'), getSysTempDir() . '/silverstripe-cache-var-www-silverstripe');
|
2009-12-01 11:26:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|