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

Public Member Functions

 testLegacyConstructorSignature ()
 legacy More...
 
 testNext ()
 
 testEndOfTemplateNext ()
 Twig_Error_Syntax Unexpected end of template More...
 
 testEndOfTemplateLook ()
 Twig_Error_Syntax Unexpected end of template More...
 

Protected Member Functions

 setUp ()
 

Static Protected Attributes

static $tokens
 

Detailed Description

Definition at line 12 of file TokenStreamTest.php.

Member Function Documentation

◆ setUp()

Twig_Tests_TokenStreamTest::setUp ( )
protected

Definition at line 16 of file TokenStreamTest.php.

References Twig_Token\EOF_TYPE, and Twig_Token\TEXT_TYPE.

17  {
18  self::$tokens = array(
27  );
28  }
const TEXT_TYPE
Definition: Token.php:27
const EOF_TYPE
Definition: Token.php:26

◆ testEndOfTemplateLook()

Twig_Tests_TokenStreamTest::testEndOfTemplateLook ( )

Twig_Error_Syntax Unexpected end of template

Definition at line 72 of file TokenStreamTest.php.

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

73  {
74  $stream = new Twig_TokenStream(array(
76  ));
77  while (!$stream->isEOF()) {
78  $stream->look();
79  $stream->next();
80  }
81  }
Represents a token stream.
Definition: TokenStream.php:20
$stream
PHP stream implementation.
const BLOCK_START_TYPE
Definition: Token.php:28

◆ testEndOfTemplateNext()

Twig_Tests_TokenStreamTest::testEndOfTemplateNext ( )

Twig_Error_Syntax Unexpected end of template

Definition at line 58 of file TokenStreamTest.php.

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

59  {
60  $stream = new Twig_TokenStream(array(
62  ));
63  while (!$stream->isEOF()) {
64  $stream->next();
65  }
66  }
Represents a token stream.
Definition: TokenStream.php:20
$stream
PHP stream implementation.
const BLOCK_START_TYPE
Definition: Token.php:28

◆ testLegacyConstructorSignature()

Twig_Tests_TokenStreamTest::testLegacyConstructorSignature ( )

legacy

Definition at line 33 of file TokenStreamTest.php.

References GuzzleHttp\Psr7\$stream.

34  {
35  $stream = new Twig_TokenStream(array(), 'foo', '{{ foo }}');
36  $this->assertEquals('foo', $stream->getFilename());
37  $this->assertEquals('{{ foo }}', $stream->getSource());
38  $this->assertEquals('foo', $stream->getSourceContext()->getName());
39  $this->assertEquals('{{ foo }}', $stream->getSourceContext()->getCode());
40  }
Represents a token stream.
Definition: TokenStream.php:20
$stream
PHP stream implementation.

◆ testNext()

Twig_Tests_TokenStreamTest::testNext ( )

Definition at line 42 of file TokenStreamTest.php.

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

43  {
44  $stream = new Twig_TokenStream(self::$tokens);
45  $repr = array();
46  while (!$stream->isEOF()) {
47  $token = $stream->next();
48 
49  $repr[] = $token->getValue();
50  }
51  $this->assertEquals('1, 2, 3, 4, 5, 6, 7', implode(', ', $repr), '->next() advances the pointer and returns the current token');
52  }
Represents a token stream.
Definition: TokenStream.php:20
$stream
PHP stream implementation.

Field Documentation

◆ $tokens

Twig_Tests_TokenStreamTest::$tokens
staticprotected

Definition at line 14 of file TokenStreamTest.php.


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