|
@@ 42-66 (lines=25) @@
|
| 39 |
|
); |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
public function testGetEchoTrans() |
| 43 |
|
{ |
| 44 |
|
$tpls = array( |
| 45 |
|
'string' => '{{ echo_trans( "foo" ) }}', |
| 46 |
|
'variable_key' => '{{ echo_trans( name ) }}', |
| 47 |
|
'quote_included' => '{{ echo_trans( "My awesome \"title\"") }}' |
| 48 |
|
); |
| 49 |
|
|
| 50 |
|
$returns = array( |
| 51 |
|
'string' => array( |
| 52 |
|
'{{ "foo"|trans({}, "Admingenerator")|raw }}', |
| 53 |
|
'trans return a good trans tag with string elements' |
| 54 |
|
), |
| 55 |
|
'variable_key' => array( |
| 56 |
|
'{{ "cedric"|trans({}, "Admingenerator")|raw }}', |
| 57 |
|
'trans return a good trans tag with variable as key' |
| 58 |
|
), |
| 59 |
|
'quote_included' => array( |
| 60 |
|
'{{ "My awesome \"title\""|trans({}, "Admingenerator")|raw }}', |
| 61 |
|
'trans return a good trans tag with variable as key' |
| 62 |
|
), |
| 63 |
|
); |
| 64 |
|
|
| 65 |
|
$this->runTwigTests($tpls, $returns); |
| 66 |
|
} |
| 67 |
|
|
| 68 |
|
public function testGetEchoTransWithEscape() |
| 69 |
|
{ |
|
@@ 89-113 (lines=25) @@
|
| 86 |
|
$this->runTwigTests($tpls, $returns); |
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
public function testGetEchoTransWithParameters() |
| 90 |
|
{ |
| 91 |
|
$tpls = array( |
| 92 |
|
'string' => "{{ echo_trans('Display all <b>%foo% %bar%</b> results', { 'foo': 'foo', 'bar': 'bar' }) }}", |
| 93 |
|
'variable_key' => '{{ echo_trans(name, { \'foo\': \'foo\', \'bar\': \'bar\' }) }}', |
| 94 |
|
'quote_in_param_value' => '{{ echo_trans(name, { \'foo\': \'foo\\\'s\', \'bar\': \'bar\' }) }}', |
| 95 |
|
); |
| 96 |
|
|
| 97 |
|
$returns = array( |
| 98 |
|
'string' => array( |
| 99 |
|
'{{ "Display all <b>%foo% %bar%</b> results"|trans({\'%foo%\': \'foo\',\'%bar%\': \'bar\',}, "Admingenerator")|raw }}', |
| 100 |
|
'trans return a good trans tag with string elements' |
| 101 |
|
), |
| 102 |
|
'variable_key' => array( |
| 103 |
|
'{{ "cedric"|trans({\'%foo%\': \'foo\',\'%bar%\': \'bar\',}, "Admingenerator")|raw }}', |
| 104 |
|
'trans return a good trans tag with variable as key' |
| 105 |
|
), |
| 106 |
|
'quote_in_param_value' => array( |
| 107 |
|
'{{ "cedric"|trans({\'%foo%\': \'foo\\\'s\',\'%bar%\': \'bar\',}, "Admingenerator")|raw }}', |
| 108 |
|
'trans return a good trans tag with variable as key' |
| 109 |
|
), |
| 110 |
|
); |
| 111 |
|
|
| 112 |
|
$this->runTwigTests($tpls, $returns); |
| 113 |
|
} |
| 114 |
|
|
| 115 |
|
public function testGetEchoTransWithParameterBag() |
| 116 |
|
{ |