mirror of
https://github.com/cosmocode/dokuwiki-plugin-struct.git
synced 2025-08-13 13:37:20 +00:00

This allows users to set custom CSS classes on aggregations potentially restyling them differently for different use cases. This makes startScope and finishScope part of the public API of the Aggregation class. It should no longer be called within render() but is instead called outside. This might potentially break plugins implementing their own aggregations. Needs to be checked
62 lines
1.8 KiB
PHP
62 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace dokuwiki\plugin\struct\test;
|
|
|
|
use dokuwiki\plugin\struct\meta;
|
|
|
|
/**
|
|
* Tests for parsing the inline aggregation config for the struct plugin
|
|
*
|
|
* @group plugin_struct
|
|
* @group plugins
|
|
*
|
|
*/
|
|
class InlineConfigParserTest extends StructTest
|
|
{
|
|
// phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
|
|
public function test_simple()
|
|
{
|
|
// Same initial setup as ConfigParser.test
|
|
$inline = '"testtable, another, foo bar"."%pageid%, count" ';
|
|
$inline .= '?sort: ^count sort: "%pageid%, ^bam" align: "r,l,center,foo"';
|
|
// Add InlineConfigParser-specific tests:
|
|
$inline .= ' & "%pageid% != start" | "count = 1"';
|
|
|
|
$configParser = new meta\InlineConfigParser($inline);
|
|
$actual_config = $configParser->getConfig();
|
|
|
|
$expected_config = [
|
|
'align' => ['right', 'left', 'center', null],
|
|
'cols' => ['%pageid%', 'count'],
|
|
'csv' => true,
|
|
'dynfilters' => false,
|
|
'filter' => [
|
|
['%pageid%', '!=', 'start', 'AND'],
|
|
['count', '=', '1', 'OR'],
|
|
],
|
|
'headers' => [null, null],
|
|
'limit' => 0,
|
|
'rownumbers' => false,
|
|
'schemas' => [
|
|
['testtable', ''],
|
|
['another', ''],
|
|
['foo', 'bar'],
|
|
],
|
|
'sepbyheaders' => false,
|
|
'sort' => [
|
|
['count', false],
|
|
['%pageid%', true],
|
|
['bam', false],
|
|
],
|
|
'summarize' => false,
|
|
'target' => '',
|
|
'widths' => [],
|
|
'nesting' => 0,
|
|
'index' => 0,
|
|
'classes' => [],
|
|
];
|
|
|
|
$this->assertEquals($expected_config, $actual_config);
|
|
}
|
|
}
|