public function testWriteINIFile() { $file = self::_createTempFile(); $data = array('foo' => 'bar', 'bar' => 3.2, 'baz' => '"Robert"', 'quux' => array('foo', 'bar', 'baz')); $expected = <<<EOF foo = "bar" bar = 3.2 baz = "\\"Robert\\"" quux[] = "foo" quux[] = "bar" quux[] = "baz" EOF; PFXUtils::writeINIFile($data, $file); $this->assertEquals($expected, file_get_contents($file)); // Append something PFXUtils::writeINIFile(array('horse' => 'secretariat'), $file, true); $expected .= 'horse = "secretariat"' . "\n"; $this->assertEquals($expected, file_get_contents($file)); $this->assertThrows('RuntimeException', array('PFXUtils', 'writeINIFile'), array($data, '/some/file/that/does/not/exist')); }