From 2a7f46af003aa0ad5bc7f8fe5554bc3807b5d202 Mon Sep 17 00:00:00 2001 From: amc Date: Thu, 30 Jun 2016 11:05:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../think/config/driver/fixtures/config.json | 1 + .../library/think/config/driver/jsonTest.php | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tests/thinkphp/library/think/config/driver/fixtures/config.json create mode 100644 tests/thinkphp/library/think/config/driver/jsonTest.php 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(); + } +}