Example #1
0
 public function testParseAndGetAndSet()
 {
     $data = "[Section]\n" . "key1=val\n" . "key2=other\n";
     $iniStructure = \Core3\Reader\Ini::parse($data);
     $this->assertInstanceOf('\\Core3\\Structure\\IniFile', $iniStructure);
     $this->assertEquals('val', $iniStructure->get('Section', 'key1'));
     $this->assertEquals('other', $iniStructure->get('Section', 'key2'));
     $iniStructure->set('Section', 'key1', 'kalle');
     $this->assertEquals('kalle', $iniStructure->get('Section', 'key1'));
 }
Example #2
0
 public function testWriteMultipleKeys2()
 {
     $iniStructure = \Core3\Reader\Ini::parse("[Section1]\n" . "n0=0\n");
     $iniStructure->set('Section2', 'n1', 1);
     $this->assertEquals("[Section1]\n" . "n0=0\n" . "\n" . "[Section2]\n" . "n1=1\n", \Core3\Writer\Ini::render($iniStructure));
 }