/** * tests parsing sections without sorting * * @group parser * @group sourcetest */ public function testParseWithoutSorting() { $lines = ['', ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; division1', '', '; this line is a comment', '[section1]', 'property11=value11', 'property12=value12', '', '; this line is a comment', '[section2]', 'property21=value21', 'property22=value22', '', ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; division2', '', '; this line is a comment', '[section3]', 'property31=value31', 'property32=value32', 'property33']; $parser = new IniParser(''); $parser->setFileLines($lines); $parser->setShouldSort(true); $expected = ['section1' => ['property11' => 'value11', 'property12' => 'value12', 'Division' => 'division1'], 'section2' => ['property21' => 'value21', 'property22' => 'value22', 'Division' => 'division1'], 'section3' => ['property31' => 'value31', 'property32' => 'value32', 'property33' => '', 'Division' => 'division2']]; $data = $parser->parse(); self::assertSame($data, $parser->getParsed()); self::assertEquals($expected, $data); }