Example #1
0
 /**
  * Test inserting an empty setting.
  *
  * @return void
  */
 public function testInsertEmpty()
 {
     $cfg = "[a]\none=1\n[b]\n";
     $test = new Writer('fake.ini', $cfg);
     $test->set('a', 'two', '');
     $ini = parse_ini_string($test->getContent(), true);
     $this->assertEquals('', $ini['a']['two']);
 }
Example #2
0
 /**
  * Test clearing values.
  *
  * @return void
  */
 public function testClear()
 {
     $cfg = "[a]\nb[]=1\nb[]=2\n[b]\nc=3\n";
     $test = new Writer('fake.ini', $cfg);
     $test->clear('a', 'b[]');
     // clear array
     $test->clear('b', 'c');
     // clear single value
     $test->clear('z', 'z');
     // clear value that does not exist
     $this->assertEquals("[a]\n[b]", trim($test->getContent()));
 }
Example #3
0
 /**
  * Test alignment of values.
  *
  * @return void
  */
 public function testTabAlignment()
 {
     $test = new Writer('fake.ini', ['general' => ['foo' => 'bar', 'foofoofoofoofoofo' => 'baz']]);
     $expected = "[general]\nfoo              = \"bar\"\nfoofoofoofoofoofo = \"baz\"\n";
     $this->assertEquals($expected, $test->getContent());
 }