Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 public function testAssocArray()
 {
     $cfg = new Config();
     $this->setExpectedException(InvalidArgumentException::class);
     $cfg->set('newkey', ['key' => 'value']);
 }
Ejemplo n.º 3
0
 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);
 }