mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-15 20:09:44 +00:00
small testing
This commit is contained in:
parent
4a183481c3
commit
da9648461e
|
@ -147,8 +147,9 @@ class Node {
|
|||
|
||||
$value = $this->extractDataFromSource( $xmlNode );
|
||||
if ( !$value && $xmlNode->{self::DEFAULT_TAG_NAME} ) {
|
||||
$value = $this->extractDataFromNode( $xmlNode->{self::DEFAULT_TAG_NAME} );
|
||||
} elseif ( $value && $xmlNode->{self::FORMAT_TAG_NAME} ) {
|
||||
return $this->extractDataFromNode( $xmlNode->{self::DEFAULT_TAG_NAME} );
|
||||
}
|
||||
if ( $value && $xmlNode->{self::FORMAT_TAG_NAME} ) {
|
||||
$value = $this->extractDataFromNode( $xmlNode->{self::FORMAT_TAG_NAME} );
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@ class NodeDataTest extends WikiaBaseTest {
|
|||
[ ], [ 'test1', 'test2' ] ],
|
||||
[ '<data><default>{{#switch: {{{test2|}}}|{{{test3}}}|{{{test4|kdjk|sajdkfj|}}}]] }}</default></data>',
|
||||
[ ], [ 'test2', 'test3', 'test4' ] ],
|
||||
[ '<data><format>my {{{test2}}}$$$</format><default>{{#switch: {{{test2|}}}|{{{test3}}}|{{{test4|kdjk|sajdkfj|}}}]] }}</default></data>',
|
||||
[ ], [ 'test2', 'test3', 'test4' ] ]
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -77,7 +79,13 @@ class NodeDataTest extends WikiaBaseTest {
|
|||
[ 'value' => 'def', 'label' => 'l' ] ],
|
||||
[ '<data source="test"><label>l</label><default>def</default></data>', [ 'test' => 1 ],
|
||||
[ 'value' => 1, 'label' => 'l' ] ],
|
||||
[ '<data></data>', [ ], [ 'label' => '', 'value' => null ] ]
|
||||
[ '<data></data>', [ ], [ 'label' => '', 'value' => null ] ],
|
||||
[ '<data source="test"><label>l</label><format>{{{test}}}%</format><default>def</default></data>', [ 'test' => 1 ],
|
||||
[ 'value' => '{{{test}}}%', 'label' => 'l' ] ],
|
||||
[ '<data source="test"><label>l</label><format>{{{not_defined_var}}}%</format><default>def</default></data>', [ 'test' => 1 ],
|
||||
[ 'value' => '{{{not_defined_var}}}%', 'label' => 'l' ] ],
|
||||
[ '<data source="test"><label>l</label><format>{{{test}}}%</format><default>def</default></data>', [ ],
|
||||
[ 'value' => 'def', 'label' => 'l' ] ],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -97,8 +105,10 @@ class NodeDataTest extends WikiaBaseTest {
|
|||
|
||||
public function dataRenderProvider() {
|
||||
return [
|
||||
[ '<data source="test"></data>', [ 'test' => 'test' ],
|
||||
[ 'type' => 'data', 'data' => [ 'value' => 'test', 'label' => '' ] ] ],
|
||||
[ '<data source="test"></data>',
|
||||
[ 'test' => 'test' ],
|
||||
[ 'type' => 'data', 'data' => [ 'value' => 'test', 'label' => '' ] ]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue