33 $accessibleClassName = $this->
buildAccessibleProxy(
'TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
34 $this->typoScriptParser =
new $accessibleClassName();
44 'prependString with string' => array(
50 'prependString with empty string' => array(
56 'appendString with string' => array(
62 'appendString with empty string' => array(
68 'removeString removes simple string' => array(
74 'removeString removes nothing if no match' => array(
80 'removeString removes multiple matches' => array(
86 'replaceString replaces simple match' => array(
92 'replaceString replaces simple match with nothing' => array(
98 'replaceString replaces multiple matches' => array(
104 'addToList adds at end of existing list' => array(
110 'addToList adds at end of existing list including white-spaces' => array(
114 '123,456, 789 , 32 , 12 ',
116 'addToList adds nothing' => array(
122 'addToList adds to empty list' => array(
128 'removeFromList removes value from list' => array(
134 'removeFromList removes value at beginning of list' => array(
140 'removeFromList removes value at end of list' => array(
146 'removeFromList removes multiple values from list' => array(
152 'removeFromList removes empty values' => array(
158 'uniqueList removes duplicates' => array(
160 '123,456,abc,456,456',
164 'uniqueList removes duplicate empty list values' => array(
170 'reverseList returns list reversed' => array(
176 'reverseList keeps empty values' => array(
178 ',123,,456,abc,,456',
180 '456,,abc,456,,123,',
182 'reverseList does not change single element' => array(
188 'sortList sorts a list' => array(
194 'sortList sorts a list numeric' => array(
200 'sortList sorts a list descending' => array(
202 '10,100,0,20,abc,-20',
204 'abc,100,20,10,0,-20',
206 'sortList sorts a list numeric descending' => array(
208 '10,100,0,20,abc,-20',
209 'descending,numeric',
210 '100,20,10,0,abc,-20',
212 'sortList ignores invalid modifier arguments' => array(
215 'foo,descending,bar',
226 $actualValue = $this->typoScriptParser->_call(
'executeValueModifier', $modifierName, $modifierArgument, $currentValue);
227 $this->assertEquals($expected, $actualValue);
237 $this->typoScriptParser->parse($typoScript);
238 $this->assertEquals($expected, $this->typoScriptParser->setup);
246 'simple assignment' => array(
252 'simple assignment with escaped dot at the beginning' => array(
258 'simple assignment with protected escaped dot at the beginning' => array(
266 'nested assignment' => array(
274 'nested assignment with escaped key' => array(
277 'lib.key' =>
'value',
280 'nested assignment with escaped key and escaped dot at the beginning' => array(
281 '\\.lib\\.key = value',
283 '.lib.key' =>
'value',
286 'nested assignment with protected escaped key' => array(
287 'lib\\\\.key = value',
289 'lib\\.' => array(
'key' =>
'value'),
292 'nested assignment with protected escaped key and protected escaped dot at the beginning' => array(
293 '\\\\.lib\\\\.key = value',
296 'lib\\.' => array(
'key' =>
'value'),
300 'assignment with escaped an non escaped keys' => array(
301 'firstkey.secondkey\\.thirdkey.setting = value',
303 'firstkey.' => array(
304 'secondkey.thirdkey.' => array(
310 'nested structured assignment' => array(
320 'nested structured assignment with escaped key inside' => array(
322 'key\\.nextkey = value' . LF .
326 'key.nextkey' =>
'value',
330 'nested structured assignment with escaped key inside and escaped dots at the beginning' => array(
332 '\\.key\\.nextkey = value' . LF .
336 '.key.nextkey' =>
'value',
340 'nested structured assignment with protected escaped key inside' => array(
342 'key\\\\.nextkey = value' . LF .
346 'key\\.' => array(
'nextkey' =>
'value'),
350 'nested structured assignment with protected escaped key inside and protected escaped dots at the beginning' => array(
352 '\\\\.key\\\\.nextkey = value' . LF .
358 'key\\.' => array(
'nextkey' =>
'value'),
364 'nested structured assignment with escaped key' => array(
365 'lib\\.anotherkey {' . LF .
369 'lib.anotherkey.' => array(
374 'nested structured assignment with protected escaped key' => array(
375 'lib\\\\.anotherkey {' . LF .
380 'anotherkey.' => array(
386 'multiline assignment' => array(
392 'key' =>
'first' . LF .
'second',
395 'multiline assignment with escaped key' => array(
396 'key\\.nextkey (' . LF .
401 'key.nextkey' =>
'first' . LF .
'second',
404 'multiline assignment with protected escaped key' => array(
405 'key\\\\.nextkey (' . LF .
410 'key\\.' => array(
'nextkey' =>
'first' . LF .
'second'),
413 'copying values' => array(
414 'lib.default = value' . LF .
415 'lib.copy < lib.default',
418 'default' =>
'value',
423 'copying values with escaped key' => array(
424 'lib\\.default = value' . LF .
425 'lib.copy < lib\\.default',
427 'lib.default' =>
'value',
433 'copying values with protected escaped key' => array(
434 'lib\\\\.default = value' . LF .
435 'lib.copy < lib\\\\.default',
437 'lib\\.' => array(
'default' =>
'value'),
443 'one-line hash comment' => array(
445 '# ignore = me' . LF .
452 'one-line slash comment' => array(
454 '// ignore = me' . LF .
461 'multi-line slash comment' => array(
472 'nested assignment repeated segment names' => array(
473 'test.test.test = 1',
482 'simple assignment operator with tab character before "="' => array(
485 'test' =>
'someValue',
488 'simple assignment operator character as value "="' => array(
494 'nested assignment operator character as value "="' => array(
502 'simple assignment character as value "<"' => array(
508 'nested assignment character as value "<"' => array(
516 'simple assignment character as value ">"' => array(
522 'nested assignment character as value ">"' => array(
530 'nested assignment repeated segment names with whitespaces' => array(
531 'test.test.test = 1' .
" \t",
540 'simple assignment operator character as value "=" with whitespaces' => array(
541 'test = =TEST=' .
" \t",
546 'nested assignment operator character as value "=" with whitespaces' => array(
547 'test.test = =TEST=' .
" \t",
554 'simple assignment character as value "<" with whitespaces' => array(
555 'test = <TEST>' .
" \t",
560 'nested assignment character as value "<" with whitespaces' => array(
561 'test.test = <TEST>' .
" \t",
568 'simple assignment character as value ">" with whitespaces' => array(
569 'test = >TEST<' .
" \t",
574 'nested assignment character as value ">" with whitespaces' => array(
575 'test.test = >TEST<',
582 'CSC example #1' => array(
583 'linkParams.ATagParams.dataWrap = class="{$styles.content.imgtext.linkWrap.lightboxCssClass}" rel="{$styles.content.imgtext.linkWrap.lightboxRelAttribute}"',
585 'linkParams.' => array(
586 'ATagParams.' => array(
587 'dataWrap' =>
'class="{$styles.content.imgtext.linkWrap.lightboxCssClass}" rel="{$styles.content.imgtext.linkWrap.lightboxRelAttribute}"',
592 'CSC example #2' => array(
593 'linkParams.ATagParams {' . LF .
594 'dataWrap = class="{$styles.content.imgtext.linkWrap.lightboxCssClass}" rel="{$styles.content.imgtext.linkWrap.lightboxRelAttribute}"' . LF .
597 'linkParams.' => array(
598 'ATagParams.' => array(
599 'dataWrap' =>
'class="{$styles.content.imgtext.linkWrap.lightboxCssClass}" rel="{$styles.content.imgtext.linkWrap.lightboxRelAttribute}"',
604 'CSC example #3' => array(
605 'linkParams.ATagParams.dataWrap (' . LF .
606 'class="{$styles.content.imgtext.linkWrap.lightboxCssClass}" rel="{$styles.content.imgtext.linkWrap.lightboxRelAttribute}"' . LF .
609 'linkParams.' => array(
610 'ATagParams.' => array(
611 'dataWrap' =>
'class="{$styles.content.imgtext.linkWrap.lightboxCssClass}" rel="{$styles.content.imgtext.linkWrap.lightboxRelAttribute}"',
616 'key with colon' => array(
617 'some:key = is valid',
619 'some:key' =>
'is valid' 622 'special operator' => array(
623 'some := addToList(a)',
628 'special operator with white-spaces' => array(
629 'some := addToList (a)',
634 'special operator with tabs' => array(
635 'some := addToList (a)',
640 'special operator with white-spaces and tabs in value' => array(
641 'some := addToList( a, b, c )',
646 'special operator and colon, no spaces' => array(
647 'some:key:=addToList(a)',
652 'key with all special symbols' => array(
653 'someSpecial\\_:-\\.Chars = is valid',
655 'someSpecial\\_:-.Chars' =>
'is valid' 668 $this->typoScriptParser->setVal($string, $setup, $value);
678 $this->typoScriptParser->setVal($string, $setup, $value);
686 list($keySegment, $remainingKey) = $this->typoScriptParser->_call(
'parseNextKeySegment', $key);
687 $this->assertSame($expectedKeySegment, $keySegment);
688 $this->assertSame($expectedRemainingKey, $remainingKey);
696 'key without separator' => array(
701 'key with normal separator' => array(
706 'key with multiple normal separators' => array(
711 'key with separator and escape character' => array(
716 'key with escaped separators' => array(
717 'test\\.key\\.subkey',
721 'key with escaped and unescaped separator 1' => array(
726 'key with escaped and unescaped separator 2' => array(
727 'test\\.test.key\\.key2',
731 'key with escaped escape character' => array(
736 'key with escaped separator and additional escape character' => array(
742 'multiple escape characters within the key are preserved' => array(
parseNextKeySegmentReturnsCorrectNextKeySegmentDataProvider()
executeValueModifierDataProvider()
typoScriptIsParsedToArrayDataProvider()
setValCanBeCalledWithArrayValueParameter()
executeValueModifierReturnsModifiedResult($modifierName, $currentValue, $modifierArgument, $expected)
typoScriptIsParsedToArray($typoScript, array $expected)
buildAccessibleProxy($className)
setValCanBeCalledWithStringValueParameter()
parseNextKeySegmentReturnsCorrectNextKeySegment($key, $expectedKeySegment, $expectedRemainingKey)