From 979749b5d36db727a4a218efd4bc60ad0eef7e7f Mon Sep 17 00:00:00 2001 From: Anton Grebnev Date: Thu, 6 Oct 2011 13:10:48 +0400 Subject: [PATCH] Config class tested --- tests/ConfigTest.php | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/ConfigTest.php diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php new file mode 100644 index 0000000..94b8878 --- /dev/null +++ b/tests/ConfigTest.php @@ -0,0 +1,47 @@ + + * @link http://netmonsters.ru + * @package Majestic + * @subpackage UnitTests + * @since 2011-10-06 + * + * Unit tests for Config class + */ + +require_once '../Registry.php'; +require_once '../Config.php'; + +class ConfigTest extends PHPUnit_Framework_TestCase +{ + + private $_instance = null; + + public function setUp() + { + $this->_instance = Config::getInstance(); + } + public function testGetInstance() + { + $this->assertSame($this->_instance, Config::getInstance()); + + /** + * @TODO: Config class does not instanciate!!! It is still Registry. Use late static binding + */ + $this->assertNotEquals('Config', get_class(Config::getInstance())); + } + + public function testArrayAsParam() + { + $arr = array( + 'one' => 1, + 'two' => 2, + 'three' => 3 + ); + + Config::set(0, $arr); + $new_arr = Config::get(0); + $this->assertEquals('ConfigArray', get_class($new_arr)); + } +} \ No newline at end of file