You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.1 KiB

  1. <?php
  2. /*
  3. * @copyright NetMonsters <team@netmonsters.ru>
  4. * @link http://netmonsters.ru
  5. * @package Majestic
  6. * @subpackage UnitTests
  7. * @since 2011-10-06
  8. *
  9. * Unit tests for Config class
  10. */
  11. require_once '../Registry.php';
  12. require_once '../Config.php';
  13. class ConfigTest extends PHPUnit_Framework_TestCase
  14. {
  15. private $_instance = null;
  16. public function setUp()
  17. {
  18. $this->_instance = Config::getInstance();
  19. }
  20. public function testGetInstance()
  21. {
  22. $this->assertSame($this->_instance, Config::getInstance());
  23. /**
  24. * @TODO: Config class does not instanciate!!! It is still Registry. Use late static binding
  25. */
  26. $this->assertNotEquals('Config', get_class(Config::getInstance()));
  27. }
  28. public function testArrayAsParam()
  29. {
  30. $arr = array(
  31. 'one' => 1,
  32. 'two' => 2,
  33. 'three' => 3
  34. );
  35. Config::set(0, $arr);
  36. $new_arr = Config::get(0);
  37. $this->assertEquals('ConfigArray', get_class($new_arr));
  38. }
  39. }