From: Chris Han Date: Tue, 10 Jul 2012 02:41:16 +0000 Subject: Add unit test for config class X-Git-Url: https://git.razvi.ro/?p=gitphp.git&a=commitdiff&h=dcf0a6b954c1aa50cfd74d3b6bbdf7d580b1f21d --- Add unit test for config class --- --- /dev/null +++ b/test/ConfigTest.php @@ -1,1 +1,45 @@ + + * @copyright Copyright (c) 2012 Christopher Han + * @package GitPHP + * @subpackage Test + */ +class GitPHP_ConfigTest extends PHPUnit_Framework_TestCase +{ + protected $config; + protected function setUp() + { + $this->config = new GitPHP_Config(); + } + + public function testDefaults() + { + $this->assertTrue($this->config->HasKey('locale')); + $this->assertEquals('en_US', $this->config->GetValue('locale')); + } + + public function testGetAndSet() + { + $this->assertFalse($this->config->HasKey('testkey')); + $this->config->SetValue('testkey', 'testvalue'); + $this->assertTrue($this->config->HasKey('testkey')); + $this->assertEquals('testvalue', $this->config->GetValue('testkey')); + $this->config->SetValue('testkey', null); + $this->assertFalse($this->config->HasKey('testkey')); + $this->assertNull($this->config->GetValue('testkey')); + } + + public function testClear() + { + $this->config->SetValue('testkey2', 'testvalue'); + $this->assertTrue($this->config->HasKey('testkey2')); + $this->config->ClearConfig(); + $this->assertFalse($this->config->HasKey('testkey2')); + } + +} + --- /dev/null +++ b/test/bootstrap.php @@ -1,1 +1,5 @@ + +