ConfigTest.php (894B)
1 <?php 2 3 class ConfigTest extends PHPUnit_Framework_TestCase 4 { 5 /* 6 * Create fake values, necessary to run the tests 7 */ 8 public function setUp() 9 { 10 $_SERVER['HTTP_HOST'] = 'localhost'; 11 $_SERVER['SCRIPT_NAME'] = 'index.php'; 12 Config::$config = null; 13 } 14 15 /** 16 * Reset everything 17 */ 18 public function tearDown() 19 { 20 putenv('APPLICATION_ENV='); 21 Config::$config = null; 22 } 23 24 public function testGetDefaultEnvironment() 25 { 26 // fake application constants 27 putenv('APPLICATION_ENV=development'); 28 29 // call for environment should return "development" 30 $this->assertEquals('index', Config::get('DEFAULT_ACTION')); 31 } 32 33 public function testGetFailingEnvironment() 34 { 35 // fake application constants 36 putenv('APPLICATION_ENV=foobar'); 37 38 // call for environment should return false because config.foobar.php does not exist 39 $this->assertEquals(false, Config::get('DEFAULT_ACTION')); 40 } 41 }