public function testFileJson() { $json = '{ "key1": "value1", "key2": { "subkey1": "subvalue1" }, "key3": "value3" }'; File::put(__DIR__ . "/test2.json", $json); $this->assertNull(Config::get('test2.key99')); $this->assertEquals('foo', Config::get('test2.key99', 'foo')); $this->assertEquals('value1', Config::get('test2.key1')); $this->assertEquals('value1', Config::get('test2.key1', 'foo')); $this->assertInternalType('array', Config::get('test2.key2')); $this->assertEquals('subvalue1', Config::get('test2.key2.subkey1')); $this->assertNull(Config::get('test2.key2.subkey1.subsubkey')); File::delete(__DIR__ . "/test2.json"); }
protected function _write($id, $data) { return \Sugi\File::put($this->path . "sess_" . $id, $data, 0666); }
/** * @expectedException PHPUnit_Framework_Error */ public function testPutWithChmod() { $this->assertEquals(11, File::put(TESTFILE, 'Hello World', 0444)); $this->assertEquals('Hello World', file_get_contents(TESTFILE)); file_put_contents(TESTFILE, 'foo'); }