Contao\CoreBundle\Test\Contao\StringUtilTest::parseSimpleTokensProvider PHP Method

parseSimpleTokensProvider() public method

Provides the data for the testParseSimpleTokens() method.
public parseSimpleTokensProvider ( ) : array
return array
    public function parseSimpleTokensProvider()
    {
        return ['Test regular token replacement' => ['This is my ##email##', ['email' => '[email protected]'], 'This is my [email protected]'], 'Test regular token replacement is non greedy' => ['This is my ##email##,##email2##', ['email' => '[email protected]', 'email2' => '[email protected]'], 'This is my [email protected],[email protected]'], 'Test token replacement with special characters (-)' => ['This is my ##e-mail##', ['e-mail' => '[email protected]'], 'This is my [email protected]'], 'Test token replacement with special characters (&)' => ['This is my ##e&mail##', ['e&mail' => '[email protected]'], 'This is my [email protected]'], 'Test token replacement with special characters (#)' => ['This is my ##e#mail##', ['e#mail' => '[email protected]'], 'This is my [email protected]'], 'Test token replacement with token delimiter (##)' => ['This is my ##e##mail##', ['e##mail' => '[email protected]'], 'This is my ##e##mail##'], 'Test comparisons (==) with regular characters (match)' => ['This is my {if email==""}match{endif}', ['email' => ''], 'This is my match'], 'Test comparisons (==) with regular characters (no match)' => ['This is my {if email==""}match{endif}', ['email' => '[email protected]'], 'This is my '], 'Test comparisons (!=) with regular characters (match)' => ['This is my {if email!=""}match{endif}', ['email' => '[email protected]'], 'This is my match'], 'Test comparisons (!=) with regular characters (no match)' => ['This is my {if email!=""}match{endif}', ['email' => ''], 'This is my '], 'Test comparisons (>) with regular characters (match)' => ['This is my {if value>0}match{endif}', ['value' => 5], 'This is my match'], 'Test comparisons (>) with regular characters (no match)' => ['This is my {if value>0}hello{endif}', ['value' => -8], 'This is my '], 'Test comparisons (>=) with regular characters (match)' => ['This is my {if value>=0}match{endif}', ['value' => 5], 'This is my match'], 'Test comparisons (>=) with regular characters (no match)' => ['This is my {if value>=0}hello{endif}', ['value' => -8], 'This is my '], 'Test comparisons (<) with regular characters (match)' => ['This is my {if value<0}match{endif}', ['value' => -5], 'This is my match'], 'Test comparisons (<) with regular characters (no match)' => ['This is my {if value<0}hello{endif}', ['value' => 9], 'This is my '], 'Test comparisons (<=) with regular characters (match)' => ['This is my {if value<=0}match{endif}', ['value' => -5], 'This is my match'], 'Test comparisons (<=) with regular characters (no match)' => ['This is my {if value<=0}hello{endif}', ['value' => 9], 'This is my '], 'Test comparisons (<) with special characters (match)' => ['This is my {if val&#ue<0}match{endif}', ['val&#ue' => -5], 'This is my match'], 'Test comparisons (<) with special characters (no match)' => ['This is my {if val&#ue<0}match{endif}', ['val&#ue' => 9], 'This is my '], 'Test comparisons (===) with regular characters (match)' => ['This is my {if value===5}match{endif}', ['value' => 5], 'This is my match'], 'Test comparisons (===) with regular characters (no match)' => ['This is my {if value===5}match{endif}', ['value' => 5.0], 'This is my '], 'Test comparisons (!==) with regular characters (match)' => ['This is my {if value!==5.0}match{endif}', ['value' => '5'], 'This is my match'], 'Test comparisons (!==) with regular characters (no match)' => ['This is my {if value!==5.0}match{endif}', ['value' => 5.0], 'This is my '], 'Test whitespace in tokens not allowed and ignored' => ['This is my ##dumb token## you know', ['dumb token' => 'foobar'], 'This is my ##dumb token## you know'], 'Test if-tags insertion not evaluated' => ['##token##', ['token' => '{if token=="foo"}'], '{if token=="foo"}'], 'Test if-tags insertion not evaluated with multiple tokens' => ['##token1####token2####token3##', ['token1' => '{', 'token2' => 'if', 'token3' => ' token=="foo"}'], '{if token=="foo"}'], 'Test nested if-tag with " in value (match)' => ['{if value=="f"oo"}1{endif}{if value=="f\\"oo"}2{endif}', ['value' => 'f"oo'], '12'], 'Test else (match)' => ['This is my {if value=="foo"}match{else}else-match{endif}', ['value' => 'foo'], 'This is my match'], 'Test else (no match)' => ['This is my {if value!="foo"}match{else}else-match{endif}', ['value' => 'foo'], 'This is my else-match'], 'Test nested if (match)' => ['0{if value=="foo"}1{if value!="foo"}2{else}3{if value=="foo"}4{else}5{endif}6{endif}7{else}8{endif}9', ['value' => 'foo'], '0134679'], 'Test nested if (no match)' => ['0{if value!="foo"}1{if value=="foo"}2{else}3{if value!="foo"}4{else}5{endif}6{endif}7{else}8{endif}9', ['value' => 'foo'], '089'], 'Test nested elseif (match)' => ['0{if value=="bar"}1{elseif value=="foo"}2{else}3{if value=="bar"}4{elseif value=="foo"}5{else}6{endif}7{endif}8', ['value' => 'foo'], '028'], 'Test nested elseif (no match)' => ['0{if value=="bar"}1{elseif value!="foo"}2{else}3{if value=="bar"}4{elseif value!="foo"}5{else}6{endif}7{endif}8', ['value' => 'foo'], '03678'], 'Test special value chars \'=!<>;$()[] (match)' => ['{if value=="\'=!<>;$()[]"}match{else}no-match{endif}', ['value' => '\'=!<>;$()[]'], 'match'], 'Test special value chars \'=!<>;$()[] (no match)' => ['{if value=="\'=!<>;$()[]"}match{else}no-match{endif}', ['value' => '=!<>;$()[]'], 'no-match'], 'Test every elseif expression is skipped if first if statement evaluates to true' => ['{if value=="foobar"}Output 1{elseif value=="foobar"}Output 2{elseif value=="foobar"}Output 3{elseif value=="foobar"}Output 4{else}Output 5{endif}', ['value' => 'foobar'], 'Output 1'], 'Test every elseif expression is skipped if first elseif statement evaluates to true' => ['{if value!="foobar"}Output 1{elseif value=="foobar"}Output 2{elseif value=="foobar"}Output 3{elseif value=="foobar"}Output 4{elseif value=="foobar"}Output 5{else}Output 6{endif}', ['value' => 'foobar'], 'Output 2'], 'Test every elseif expression is skipped if second elseif statement evaluates to true' => ['{if value!="foobar"}Output 1{elseif value!="foobar"}Output 2{elseif value=="foobar"}Output 3{elseif value=="foobar"}Output 4{elseif value=="foobar"}Output 5{elseif value=="foobar"}Output 6{else}Output 7{endif}', ['value' => 'foobar'], 'Output 3']];
    }