silverstripe-framework/tests/CoreTest.php
Sam Minnee c212f40bb5 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.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@97731 467b73ca-7a2a-4603-9d3b-597d59a354a9
2011-02-02 14:18:15 +13: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');
}
}
}