|
@ -15,23 +15,24 @@ require_once dirname(__FILE__) . '/../Config.php'; |
|
|
|
|
|
|
|
|
class ConfigTest extends PHPUnit_Framework_TestCase |
|
|
class ConfigTest extends PHPUnit_Framework_TestCase |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private $_instance = null; |
|
|
private $_instance = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function setUp() |
|
|
public function setUp() |
|
|
{ |
|
|
{ |
|
|
$this->_instance = Config::getInstance(); |
|
|
$this->_instance = Config::getInstance(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function testGetInstance() |
|
|
public function testGetInstance() |
|
|
{ |
|
|
{ |
|
|
$this->assertSame($this->_instance, Config::getInstance()); |
|
|
$this->assertSame($this->_instance, Config::getInstance()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @TODO: Config - class does not instanciate, Registry instead!!! Use late static binding |
|
|
* @TODO: Config - class does not instanciate, Registry instead!!! Use late static binding |
|
|
*/ |
|
|
*/ |
|
|
$this->assertNotEquals('Config', get_class(Config::getInstance())); |
|
|
$this->assertNotEquals('Config', get_class(Config::getInstance())); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @expectedException Exception |
|
|
* @expectedException Exception |
|
|
* @expectedExceptionMessage Configuration variable |
|
|
* @expectedExceptionMessage Configuration variable |
|
@ -39,20 +40,20 @@ class ConfigTest extends PHPUnit_Framework_TestCase |
|
|
public function testArrayAsParam() |
|
|
public function testArrayAsParam() |
|
|
{ |
|
|
{ |
|
|
$arr = array( |
|
|
$arr = array( |
|
|
'one' => 1, |
|
|
|
|
|
'two' => 2, |
|
|
|
|
|
'three' => 3, |
|
|
|
|
|
4 => 'four' |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'one' => 1, |
|
|
|
|
|
'two' => 2, |
|
|
|
|
|
'three' => 3, |
|
|
|
|
|
4 => 'four' |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
Config::set(0, $arr); |
|
|
Config::set(0, $arr); |
|
|
$new_arr = Config::get(0); |
|
|
$new_arr = Config::get(0); |
|
|
$this->assertEquals('ConfigArray', get_class($new_arr)); |
|
|
$this->assertEquals('ConfigArray', get_class($new_arr)); |
|
|
$this->assertEquals('four', $new_arr->offsetGet(4)); |
|
|
$this->assertEquals('four', $new_arr->offsetGet(4)); |
|
|
$this->assertEquals(1, $new_arr->one); |
|
|
$this->assertEquals(1, $new_arr->one); |
|
|
$this->assertNotEquals(1, $new_arr->offsetGet('two')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assertNotEquals(1, $new_arr->offsetGet('two')); |
|
|
|
|
|
|
|
|
$new_arr->some; |
|
|
$new_arr->some; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |