public function test_width() { $lines = array('width: 5, 15px, 23.4em, meh, 10em'); $configParser = new meta\ConfigParser($lines); $config = $configParser->getConfig(); $this->assertEquals(array('5px', '15px', '23.4em', '', '10em'), $config['widths']); }
public function test_emptyfield() { global $ID; $ID = 'no:data'; $lines = array("schema : bar", "cols : %pageid%, data", "filter : %pageid% = \$STRUCT.foo.pages\$"); $configParser = new meta\ConfigParser($lines); $actual_config = $configParser->getConfig(); $search = new meta\SearchConfig($actual_config); $result = $search->execute(); $this->assertEquals(0, count($result), 'if no pages a given, then none should be shown'); }
/** * Handle matches of the struct syntax * * @param string $match The match of the syntax * @param int $state The state of the handler * @param int $pos The position in the document * @param Doku_Handler $handler The handler * @return array Data for the renderer */ public function handle($match, $state, $pos, Doku_Handler $handler) { global $conf; $lines = explode("\n", $match); array_shift($lines); array_pop($lines); try { $parser = new ConfigParser($lines); $config = $parser->getConfig(); return $config; } catch (StructException $e) { msg($e->getMessage(), -1, $e->getLine(), $e->getFile()); if ($conf['allowdebug']) { msg('<pre>' . hsc($e->getTraceAsString()) . '</pre>', -1); } return null; } }