18fed17f3SAndreas Gohr<?php 28fed17f3SAndreas Gohr 38fed17f3SAndreas Gohrnamespace dokuwiki\plugin\struct\test; 48fed17f3SAndreas Gohr 58fed17f3SAndreas Gohruse dokuwiki\plugin\struct\meta; 68fed17f3SAndreas Gohr 78fed17f3SAndreas Gohr/** 88fed17f3SAndreas Gohr * Tests for parsing the inline aggregation config for the struct plugin 98fed17f3SAndreas Gohr * 108fed17f3SAndreas Gohr * @group plugin_struct 118fed17f3SAndreas Gohr * @group plugins 128fed17f3SAndreas Gohr * 138fed17f3SAndreas Gohr */ 148fed17f3SAndreas Gohrclass InlineConfigParserTest extends StructTest 158fed17f3SAndreas Gohr{ 168fed17f3SAndreas Gohr // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps 178fed17f3SAndreas Gohr public function test_simple() 188fed17f3SAndreas Gohr { 198fed17f3SAndreas Gohr // Same initial setup as ConfigParser.test 208fed17f3SAndreas Gohr $inline = '"testtable, another, foo bar"."%pageid%, count" '; 218fed17f3SAndreas Gohr $inline .= '?sort: ^count sort: "%pageid%, ^bam" align: "r,l,center,foo"'; 228fed17f3SAndreas Gohr // Add InlineConfigParser-specific tests: 238fed17f3SAndreas Gohr $inline .= ' & "%pageid% != start" | "count = 1"'; 248fed17f3SAndreas Gohr 258fed17f3SAndreas Gohr $configParser = new meta\InlineConfigParser($inline); 268fed17f3SAndreas Gohr $actual_config = $configParser->getConfig(); 278fed17f3SAndreas Gohr 288fed17f3SAndreas Gohr $expected_config = [ 298fed17f3SAndreas Gohr 'align' => ['right', 'left', 'center', null], 308fed17f3SAndreas Gohr 'cols' => ['%pageid%', 'count'], 318fed17f3SAndreas Gohr 'csv' => true, 328fed17f3SAndreas Gohr 'dynfilters' => false, 338fed17f3SAndreas Gohr 'filter' => [ 348fed17f3SAndreas Gohr ['%pageid%', '!=', 'start', 'AND'], 358fed17f3SAndreas Gohr ['count', '=', '1', 'OR'], 368fed17f3SAndreas Gohr ], 378fed17f3SAndreas Gohr 'headers' => [null, null], 388fed17f3SAndreas Gohr 'limit' => 0, 398fed17f3SAndreas Gohr 'rownumbers' => false, 408fed17f3SAndreas Gohr 'schemas' => [ 418fed17f3SAndreas Gohr ['testtable', ''], 428fed17f3SAndreas Gohr ['another', ''], 438fed17f3SAndreas Gohr ['foo', 'bar'], 448fed17f3SAndreas Gohr ], 458fed17f3SAndreas Gohr 'sepbyheaders' => false, 468fed17f3SAndreas Gohr 'sort' => [ 478fed17f3SAndreas Gohr ['count', false], 488fed17f3SAndreas Gohr ['%pageid%', true], 498fed17f3SAndreas Gohr ['bam', false], 508fed17f3SAndreas Gohr ], 518fed17f3SAndreas Gohr 'summarize' => false, 528fed17f3SAndreas Gohr 'target' => '', 538fed17f3SAndreas Gohr 'widths' => [], 54f6acb215SAndreas Gohr 'nesting' => 0, 5500f71f17SAndreas Gohr 'index' => 0, 56af0ce8d2SAndreas Gohr 'classes' => [], 57*e303766cSAndreas Gohr 'actcol' => -1, 588fed17f3SAndreas Gohr ]; 598fed17f3SAndreas Gohr 608fed17f3SAndreas Gohr $this->assertEquals($expected_config, $actual_config); 618fed17f3SAndreas Gohr } 628fed17f3SAndreas Gohr} 63