public function testSaveData() { $storage = new File($this->sampleWrite); $cfg = new Config($storage); $cfg->set('name', 'first'); $contents = file_get_contents($this->sampleWrite); $this->assertTrue(strpos($contents, '"name":"first"') !== false); $cfg->push('name', 'last'); $contents = file_get_contents($this->sampleWrite); $this->assertTrue(strpos($contents, '"name[1]":"last"') !== false); }
public function testAssocArray() { $cfg = new Config(); $this->setExpectedException(InvalidArgumentException::class); $cfg->set('newkey', ['key' => 'value']); }
public function testSet() { $cfg = new Config($this->data); $newValue = rand(); $cfg->set('fooo', $newValue); $this->assertSame($cfg->get('fooo'), $newValue); $cfg->set('foo.bar', $newValue); $this->assertSame($cfg->get('foo.bar'), $newValue); }