silverstripe-framework/tests/CoreTest.php
Ingo Schommer 29ea7e0b98 BUGFIX Use BASE_PATH and BASE_URL instead of data from $_SERVER.
API CHANGE: Determine default BASE_PATH/BASE_URL from the __FILE__ content, so that the script that initiated the Sapphire process doesn't matter.  This means that index.php doesn't need to manipulate those variables. (from r97731)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102528 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-04-12 23:15:04 +00:00

34 lines
1.1 KiB
PHP

<?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 {
protected $tempPath;
public function setUp() {
parent::setUp();
$this->tempPath = $tempPath = Director::baseFolder() . '/silverstripe-cache';
}
public function testGetTempPathInProject() {
if(file_exists($this->tempPath)) {
$this->assertEquals(getTempFolder(), $this->tempPath);
} else {
// A typical Windows location for where sites are stored on IIS
$this->assertEquals(getTempFolder('C:\\inetpub\\wwwroot\\silverstripe'), getSysTempDir() . '/silverstripe-cacheC--inetpub-wwwroot-silverstripe');
// A typical Mac OS X location for where sites are stored
$this->assertEquals(getTempFolder('/Users/joebloggs/Sites/silverstripe'), getSysTempDir() . '/silverstripe-cache-Users-joebloggs-Sites-silverstripe');
// A typical Linux location for where sites are stored
$this->assertEquals(getTempFolder('/var/www/silverstripe'), getSysTempDir() . '/silverstripe-cache-var-www-silverstripe');
}
}
}