diff --git a/tests/thinkphp/library/think/config/driver/fixtures/config.json b/tests/thinkphp/library/think/config/driver/fixtures/config.json new file mode 100644 index 00000000..716ed064 --- /dev/null +++ b/tests/thinkphp/library/think/config/driver/fixtures/config.json @@ -0,0 +1 @@ +{"jsonstring":1} \ No newline at end of file diff --git a/tests/thinkphp/library/think/config/driver/jsonTest.php b/tests/thinkphp/library/think/config/driver/jsonTest.php new file mode 100644 index 00000000..9d438d40 --- /dev/null +++ b/tests/thinkphp/library/think/config/driver/jsonTest.php @@ -0,0 +1,33 @@ + +// +---------------------------------------------------------------------- + +/** + * Xml配置测试 + * @author 7IN0SAN9 + */ + +namespace tests\thinkphp\library\think\config\driver; + +use think\config; + +class jsonTest extends \PHPUnit_Framework_TestCase +{ + public function testParse() + { + Config::parse('{"jsonstring":1}', 'json'); + $this->assertEquals(1, Config::get('jsonstring')); + Config::reset(); + Config::parse(__DIR__ . '/fixtures/config.json'); + $this->assertTrue(Config::has('jsonstring')); + $this->assertEquals(1, Config::get('jsonstring')); + Config::reset(); + } +}