Esempio n. 1
0
 public function testLookupToken()
 {
     $this->assertEquals(Token::T_AMPERSAND, \vc\Tokens\Parser::lookupToken('&'));
     try {
         \vc\Tokens\Parser::lookupToken('blah');
         $this->fail("An expected exception was not thrown");
     } catch (\vc\Tokens\Exception\UnrecognizedToken $err) {
     }
 }
Esempio n. 2
0
 /**
  * Adds an array definition to the token stream
  *
  * @return \vc\iface\Tokens\Reader Returns a self reference
  */
 public function thenAnArrayValue(array $value)
 {
     $content = trim('<?php ' . var_export($value, TRUE));
     $content = str_replace("\n", "", $content);
     $content = token_get_all($content);
     array_shift($content);
     foreach ($content as $token) {
         if (is_array($token)) {
             $this->then($token[0], $token[0] == Token::T_WHITESPACE ? ' ' : $token[1], 1);
         } else {
             $this->then(\vc\Tokens\Parser::lookupToken($token), $token, 1);
         }
     }
     return $this;
 }