ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Twig_Tests_LexerTest Class Reference
+ Inheritance diagram for Twig_Tests_LexerTest:
+ Collaboration diagram for Twig_Tests_LexerTest:

Public Member Functions

 testLegacyConstructorSignature ()
 legacy More...
 
 testNameLabelForTag ()
 
 testNameLabelForFunction ()
 
 testBracketsNesting ()
 
 testLineDirective ()
 
 testLineDirectiveInline ()
 
 testLongComments ()
 
 testLongVerbatim ()
 
 testLongVar ()
 
 testLongBlock ()
 
 testBigNumbers ()
 
 testStringWithEscapedDelimiter ()
 
 testStringWithInterpolation ()
 
 testStringWithEscapedInterpolation ()
 
 testStringWithHash ()
 
 testStringWithUnterminatedInterpolation ()
 Twig_Error_Syntax Unclosed """ More...
 
 testStringWithNestedInterpolations ()
 
 testStringWithNestedInterpolationsInBlock ()
 
 testOperatorEndingWithALetterAtTheEndOfALine ()
 
 testUnterminatedVariable ()
 Twig_Error_Syntax Unclosed "variable" in "index" at line 3 More...
 
 testUnterminatedBlock ()
 Twig_Error_Syntax Unclosed "block" in "index" at line 3 More...
 

Protected Member Functions

 countToken ($template, $type, $value=null)
 

Detailed Description

Definition at line 11 of file LexerTest.php.

Member Function Documentation

◆ countToken()

Twig_Tests_LexerTest::countToken (   $template,
  $type,
  $value = null 
)
protected

Definition at line 54 of file LexerTest.php.

References GuzzleHttp\Psr7\$stream, $template, PHPMailer\PHPMailer\$token, and $type.

Referenced by testBracketsNesting().

55  {
56  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
57  $stream = $lexer->tokenize(new Twig_Source($template, 'index'));
58 
59  $count = 0;
60  while (!$stream->isEOF()) {
61  $token = $stream->next();
62  if ($type === $token->getType()) {
63  if (null === $value || $value === $token->getValue()) {
64  ++$count;
65  }
66  }
67  }
68 
69  return $count;
70  }
$template
$type
$stream
PHP stream implementation.
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
Lexes a template string.
Definition: Lexer.php:18
+ Here is the caller graph for this function:

◆ testBigNumbers()

Twig_Tests_LexerTest::testBigNumbers ( )

Definition at line 160 of file LexerTest.php.

References GuzzleHttp\Psr7\$stream, and $template.

161  {
162  $template = '{{ 922337203685477580700 }}';
163 
164  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
165  $stream = $lexer->tokenize(new Twig_Source($template, 'index'));
166  $stream->next();
167  $node = $stream->next();
168  $this->assertEquals('922337203685477580700', $node->getValue());
169  }
$template
$stream
PHP stream implementation.
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
Lexes a template string.
Definition: Lexer.php:18

◆ testBracketsNesting()

Twig_Tests_LexerTest::testBracketsNesting ( )

Definition at line 46 of file LexerTest.php.

References $template, countToken(), and Twig_Token\PUNCTUATION_TYPE.

47  {
48  $template = '{{ {"a":{"b":"c"}} }}';
49 
50  $this->assertEquals(2, $this->countToken($template, Twig_Token::PUNCTUATION_TYPE, '{'));
51  $this->assertEquals(2, $this->countToken($template, Twig_Token::PUNCTUATION_TYPE, '}'));
52  }
const PUNCTUATION_TYPE
Definition: Token.php:36
$template
countToken($template, $type, $value=null)
Definition: LexerTest.php:54
+ Here is the call graph for this function:

◆ testLegacyConstructorSignature()

Twig_Tests_LexerTest::testLegacyConstructorSignature ( )

legacy

Definition at line 16 of file LexerTest.php.

References GuzzleHttp\Psr7\$stream.

17  {
18  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
19  $stream = $lexer->tokenize('{{ foo }}', 'foo');
20  $this->assertEquals('foo', $stream->getFilename());
21  $this->assertEquals('{{ foo }}', $stream->getSource());
22  }
$stream
PHP stream implementation.
Stores the Twig configuration.
Definition: Environment.php:17
Lexes a template string.
Definition: Lexer.php:18

◆ testLineDirective()

Twig_Tests_LexerTest::testLineDirective ( )

Definition at line 72 of file LexerTest.php.

References GuzzleHttp\Psr7\$stream, $template, Twig_Token\NAME_TYPE, Twig_Token\TEXT_TYPE, and Twig_Token\VAR_START_TYPE.

73  {
74  $template = "foo\n"
75  ."bar\n"
76  ."{% line 10 %}\n"
77  ."{{\n"
78  ."baz\n"
79  ."}}\n";
80 
81  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
82  $stream = $lexer->tokenize(new Twig_Source($template, 'index'));
83 
84  // foo\nbar\n
85  $this->assertSame(1, $stream->expect(Twig_Token::TEXT_TYPE)->getLine());
86  // \n (after {% line %})
87  $this->assertSame(10, $stream->expect(Twig_Token::TEXT_TYPE)->getLine());
88  // {{
89  $this->assertSame(11, $stream->expect(Twig_Token::VAR_START_TYPE)->getLine());
90  // baz
91  $this->assertSame(12, $stream->expect(Twig_Token::NAME_TYPE)->getLine());
92  }
$template
$stream
PHP stream implementation.
const TEXT_TYPE
Definition: Token.php:27
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
const VAR_START_TYPE
Definition: Token.php:29
const NAME_TYPE
Definition: Token.php:32
Lexes a template string.
Definition: Lexer.php:18

◆ testLineDirectiveInline()

Twig_Tests_LexerTest::testLineDirectiveInline ( )

Definition at line 94 of file LexerTest.php.

References GuzzleHttp\Psr7\$stream, $template, Twig_Token\NAME_TYPE, Twig_Token\TEXT_TYPE, and Twig_Token\VAR_START_TYPE.

95  {
96  $template = "foo\n"
97  ."bar{% line 10 %}{{\n"
98  ."baz\n"
99  ."}}\n";
100 
101  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
102  $stream = $lexer->tokenize(new Twig_Source($template, 'index'));
103 
104  // foo\nbar
105  $this->assertSame(1, $stream->expect(Twig_Token::TEXT_TYPE)->getLine());
106  // {{
107  $this->assertSame(10, $stream->expect(Twig_Token::VAR_START_TYPE)->getLine());
108  // baz
109  $this->assertSame(11, $stream->expect(Twig_Token::NAME_TYPE)->getLine());
110  }
$template
$stream
PHP stream implementation.
const TEXT_TYPE
Definition: Token.php:27
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
const VAR_START_TYPE
Definition: Token.php:29
const NAME_TYPE
Definition: Token.php:32
Lexes a template string.
Definition: Lexer.php:18

◆ testLongBlock()

Twig_Tests_LexerTest::testLongBlock ( )

Definition at line 148 of file LexerTest.php.

References $template.

149  {
150  $template = '{% '.str_repeat('x', 100000).' %}';
151 
152  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
153  $lexer->tokenize(new Twig_Source($template, 'index'));
154 
155  // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
156  // can be executed without throwing any exceptions
157  $this->addToAssertionCount(1);
158  }
$template
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
Lexes a template string.
Definition: Lexer.php:18

◆ testLongComments()

Twig_Tests_LexerTest::testLongComments ( )

Definition at line 112 of file LexerTest.php.

References $template.

113  {
114  $template = '{# '.str_repeat('*', 100000).' #}';
115 
116  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
117  $lexer->tokenize(new Twig_Source($template, 'index'));
118 
119  // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
120  // can be executed without throwing any exceptions
121  $this->addToAssertionCount(1);
122  }
$template
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
Lexes a template string.
Definition: Lexer.php:18

◆ testLongVar()

Twig_Tests_LexerTest::testLongVar ( )

Definition at line 136 of file LexerTest.php.

References $template.

137  {
138  $template = '{{ '.str_repeat('x', 100000).' }}';
139 
140  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
141  $lexer->tokenize(new Twig_Source($template, 'index'));
142 
143  // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
144  // can be executed without throwing any exceptions
145  $this->addToAssertionCount(1);
146  }
$template
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
Lexes a template string.
Definition: Lexer.php:18

◆ testLongVerbatim()

Twig_Tests_LexerTest::testLongVerbatim ( )

Definition at line 124 of file LexerTest.php.

References $template.

125  {
126  $template = '{% verbatim %}'.str_repeat('*', 100000).'{% endverbatim %}';
127 
128  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
129  $lexer->tokenize(new Twig_Source($template, 'index'));
130 
131  // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
132  // can be executed without throwing any exceptions
133  $this->addToAssertionCount(1);
134  }
$template
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
Lexes a template string.
Definition: Lexer.php:18

◆ testNameLabelForFunction()

Twig_Tests_LexerTest::testNameLabelForFunction ( )

Definition at line 35 of file LexerTest.php.

References GuzzleHttp\Psr7\$stream, $template, Twig_Token\NAME_TYPE, and Twig_Token\VAR_START_TYPE.

36  {
37  $template = '{{ §() }}';
38 
39  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
40  $stream = $lexer->tokenize(new Twig_Source($template, 'index'));
41 
43  $this->assertSame('§', $stream->expect(Twig_Token::NAME_TYPE)->getValue());
44  }
$template
$stream
PHP stream implementation.
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
const VAR_START_TYPE
Definition: Token.php:29
const NAME_TYPE
Definition: Token.php:32
Lexes a template string.
Definition: Lexer.php:18

◆ testNameLabelForTag()

Twig_Tests_LexerTest::testNameLabelForTag ( )

Definition at line 24 of file LexerTest.php.

References GuzzleHttp\Psr7\$stream, $template, Twig_Token\BLOCK_START_TYPE, and Twig_Token\NAME_TYPE.

25  {
26  $template = '{% § %}';
27 
28  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
29  $stream = $lexer->tokenize(new Twig_Source($template, 'index'));
30 
32  $this->assertSame('§', $stream->expect(Twig_Token::NAME_TYPE)->getValue());
33  }
$template
$stream
PHP stream implementation.
const BLOCK_START_TYPE
Definition: Token.php:28
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
const NAME_TYPE
Definition: Token.php:32
Lexes a template string.
Definition: Lexer.php:18

◆ testOperatorEndingWithALetterAtTheEndOfALine()

Twig_Tests_LexerTest::testOperatorEndingWithALetterAtTheEndOfALine ( )

Definition at line 295 of file LexerTest.php.

References GuzzleHttp\Psr7\$stream, $template, Twig_Token\NUMBER_TYPE, Twig_Token\OPERATOR_TYPE, and Twig_Token\VAR_START_TYPE.

296  {
297  $template = "{{ 1 and\n0}}";
298 
299  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
300  $stream = $lexer->tokenize(new Twig_Source($template, 'index'));
302  $stream->expect(Twig_Token::NUMBER_TYPE, 1);
303  $stream->expect(Twig_Token::OPERATOR_TYPE, 'and');
304 
305  // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
306  // can be executed without throwing any exceptions
307  $this->addToAssertionCount(1);
308  }
$template
$stream
PHP stream implementation.
const NUMBER_TYPE
Definition: Token.php:33
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
const OPERATOR_TYPE
Definition: Token.php:35
const VAR_START_TYPE
Definition: Token.php:29
Lexes a template string.
Definition: Lexer.php:18

◆ testStringWithEscapedDelimiter()

Twig_Tests_LexerTest::testStringWithEscapedDelimiter ( )

Definition at line 171 of file LexerTest.php.

References GuzzleHttp\Psr7\$stream, $template, $tests, Twig_Token\STRING_TYPE, and Twig_Token\VAR_START_TYPE.

172  {
173  $tests = array(
174  "{{ 'foo \' bar' }}" => 'foo \' bar',
175  '{{ "foo \" bar" }}' => 'foo " bar',
176  );
177  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
178  foreach ($tests as $template => $expected) {
179  $stream = $lexer->tokenize(new Twig_Source($template, 'index'));
181  $stream->expect(Twig_Token::STRING_TYPE, $expected);
182 
183  // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
184  // can be executed without throwing any exceptions
185  $this->addToAssertionCount(1);
186  }
187  }
$template
$stream
PHP stream implementation.
const STRING_TYPE
Definition: Token.php:34
$tests
Definition: bench.php:104
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
const VAR_START_TYPE
Definition: Token.php:29
Lexes a template string.
Definition: Lexer.php:18

◆ testStringWithEscapedInterpolation()

Twig_Tests_LexerTest::testStringWithEscapedInterpolation ( )

Definition at line 210 of file LexerTest.php.

References GuzzleHttp\Psr7\$stream, $template, Twig_Token\STRING_TYPE, Twig_Token\VAR_END_TYPE, and Twig_Token\VAR_START_TYPE.

211  {
212  $template = '{{ "bar \#{baz+1}" }}';
213 
214  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
215  $stream = $lexer->tokenize(new Twig_Source($template, 'index'));
217  $stream->expect(Twig_Token::STRING_TYPE, 'bar #{baz+1}');
219 
220  // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
221  // can be executed without throwing any exceptions
222  $this->addToAssertionCount(1);
223  }
$template
$stream
PHP stream implementation.
const STRING_TYPE
Definition: Token.php:34
const VAR_END_TYPE
Definition: Token.php:31
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
const VAR_START_TYPE
Definition: Token.php:29
Lexes a template string.
Definition: Lexer.php:18

◆ testStringWithHash()

Twig_Tests_LexerTest::testStringWithHash ( )

Definition at line 225 of file LexerTest.php.

References GuzzleHttp\Psr7\$stream, $template, Twig_Token\STRING_TYPE, Twig_Token\VAR_END_TYPE, and Twig_Token\VAR_START_TYPE.

226  {
227  $template = '{{ "bar # baz" }}';
228 
229  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
230  $stream = $lexer->tokenize(new Twig_Source($template, 'index'));
232  $stream->expect(Twig_Token::STRING_TYPE, 'bar # baz');
234 
235  // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
236  // can be executed without throwing any exceptions
237  $this->addToAssertionCount(1);
238  }
$template
$stream
PHP stream implementation.
const STRING_TYPE
Definition: Token.php:34
const VAR_END_TYPE
Definition: Token.php:31
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
const VAR_START_TYPE
Definition: Token.php:29
Lexes a template string.
Definition: Lexer.php:18

◆ testStringWithInterpolation()

Twig_Tests_LexerTest::testStringWithInterpolation ( )

Definition at line 189 of file LexerTest.php.

References GuzzleHttp\Psr7\$stream, $template, Twig_Token\INTERPOLATION_END_TYPE, Twig_Token\INTERPOLATION_START_TYPE, Twig_Token\NAME_TYPE, Twig_Token\NUMBER_TYPE, Twig_Token\OPERATOR_TYPE, Twig_Token\STRING_TYPE, Twig_Token\TEXT_TYPE, Twig_Token\VAR_END_TYPE, and Twig_Token\VAR_START_TYPE.

190  {
191  $template = 'foo {{ "bar #{ baz + 1 }" }}';
192 
193  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
194  $stream = $lexer->tokenize(new Twig_Source($template, 'index'));
195  $stream->expect(Twig_Token::TEXT_TYPE, 'foo ');
197  $stream->expect(Twig_Token::STRING_TYPE, 'bar ');
199  $stream->expect(Twig_Token::NAME_TYPE, 'baz');
200  $stream->expect(Twig_Token::OPERATOR_TYPE, '+');
201  $stream->expect(Twig_Token::NUMBER_TYPE, '1');
204 
205  // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
206  // can be executed without throwing any exceptions
207  $this->addToAssertionCount(1);
208  }
$template
$stream
PHP stream implementation.
const STRING_TYPE
Definition: Token.php:34
const VAR_END_TYPE
Definition: Token.php:31
const TEXT_TYPE
Definition: Token.php:27
const INTERPOLATION_END_TYPE
Definition: Token.php:38
const NUMBER_TYPE
Definition: Token.php:33
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
const OPERATOR_TYPE
Definition: Token.php:35
const VAR_START_TYPE
Definition: Token.php:29
const NAME_TYPE
Definition: Token.php:32
const INTERPOLATION_START_TYPE
Definition: Token.php:37
Lexes a template string.
Definition: Lexer.php:18

◆ testStringWithNestedInterpolations()

Twig_Tests_LexerTest::testStringWithNestedInterpolations ( )

Definition at line 252 of file LexerTest.php.

References GuzzleHttp\Psr7\$stream, $template, Twig_Token\INTERPOLATION_END_TYPE, Twig_Token\INTERPOLATION_START_TYPE, Twig_Token\NAME_TYPE, Twig_Token\STRING_TYPE, Twig_Token\VAR_END_TYPE, and Twig_Token\VAR_START_TYPE.

253  {
254  $template = '{{ "bar #{ "foo#{bar}" }" }}';
255 
256  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
257  $stream = $lexer->tokenize(new Twig_Source($template, 'index'));
259  $stream->expect(Twig_Token::STRING_TYPE, 'bar ');
261  $stream->expect(Twig_Token::STRING_TYPE, 'foo');
263  $stream->expect(Twig_Token::NAME_TYPE, 'bar');
267 
268  // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
269  // can be executed without throwing any exceptions
270  $this->addToAssertionCount(1);
271  }
$template
$stream
PHP stream implementation.
const STRING_TYPE
Definition: Token.php:34
const VAR_END_TYPE
Definition: Token.php:31
const INTERPOLATION_END_TYPE
Definition: Token.php:38
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
const VAR_START_TYPE
Definition: Token.php:29
const NAME_TYPE
Definition: Token.php:32
const INTERPOLATION_START_TYPE
Definition: Token.php:37
Lexes a template string.
Definition: Lexer.php:18

◆ testStringWithNestedInterpolationsInBlock()

Twig_Tests_LexerTest::testStringWithNestedInterpolationsInBlock ( )

Definition at line 273 of file LexerTest.php.

References GuzzleHttp\Psr7\$stream, $template, Twig_Token\BLOCK_END_TYPE, Twig_Token\BLOCK_START_TYPE, Twig_Token\INTERPOLATION_END_TYPE, Twig_Token\INTERPOLATION_START_TYPE, Twig_Token\NAME_TYPE, and Twig_Token\STRING_TYPE.

274  {
275  $template = '{% foo "bar #{ "foo#{bar}" }" %}';
276 
277  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
278  $stream = $lexer->tokenize(new Twig_Source($template, 'index'));
280  $stream->expect(Twig_Token::NAME_TYPE, 'foo');
281  $stream->expect(Twig_Token::STRING_TYPE, 'bar ');
283  $stream->expect(Twig_Token::STRING_TYPE, 'foo');
285  $stream->expect(Twig_Token::NAME_TYPE, 'bar');
289 
290  // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above
291  // can be executed without throwing any exceptions
292  $this->addToAssertionCount(1);
293  }
$template
$stream
PHP stream implementation.
const STRING_TYPE
Definition: Token.php:34
const BLOCK_START_TYPE
Definition: Token.php:28
const INTERPOLATION_END_TYPE
Definition: Token.php:38
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
const NAME_TYPE
Definition: Token.php:32
const INTERPOLATION_START_TYPE
Definition: Token.php:37
Lexes a template string.
Definition: Lexer.php:18
const BLOCK_END_TYPE
Definition: Token.php:30

◆ testStringWithUnterminatedInterpolation()

Twig_Tests_LexerTest::testStringWithUnterminatedInterpolation ( )

Twig_Error_Syntax Unclosed """

Definition at line 244 of file LexerTest.php.

References $template.

245  {
246  $template = '{{ "bar #{x" }}';
247 
248  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
249  $lexer->tokenize(new Twig_Source($template, 'index'));
250  }
$template
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
Lexes a template string.
Definition: Lexer.php:18

◆ testUnterminatedBlock()

Twig_Tests_LexerTest::testUnterminatedBlock ( )

Twig_Error_Syntax Unclosed "block" in "index" at line 3

Definition at line 333 of file LexerTest.php.

References $template.

334  {
335  $template = '
336 
337 {%
338 
339 bar
340 
341 
342 ';
343 
344  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
345  $lexer->tokenize(new Twig_Source($template, 'index'));
346  }
$template
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
Lexes a template string.
Definition: Lexer.php:18

◆ testUnterminatedVariable()

Twig_Tests_LexerTest::testUnterminatedVariable ( )

Twig_Error_Syntax Unclosed "variable" in "index" at line 3

Definition at line 314 of file LexerTest.php.

References $template.

315  {
316  $template = '
317 
318 {{
319 
320 bar
321 
322 
323 ';
324 
325  $lexer = new Twig_Lexer(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()));
326  $lexer->tokenize(new Twig_Source($template, 'index'));
327  }
$template
Holds information about a non-compiled Twig template.
Definition: Source.php:19
Stores the Twig configuration.
Definition: Environment.php:17
Lexes a template string.
Definition: Lexer.php:18

The documentation for this class was generated from the following file: