Пример #1
0
 /**
  * Returns a Closure matching a Token by Value
  *
  * @param string|array $values
  * @return \Closure
  */
 public static function getHasValueClosure($values)
 {
     return function (Token $token) use($values) {
         $helper = new AHelper();
         return $helper->hasValue($token, $values);
     };
 }
Пример #2
0
 /**
  * @param  \PHP\Manipulator\TokenContainer\Iterator $iterator
  * @param  \Closure $closure
  * @param  \PHP\Manipulator\Token $token
  *
  * @dataProvider getNextMatchingTokenProvider
  * @covers \PHP\Manipulator\AHelper::getNextMatchingToken
  */
 public function testGetNextMatchingToken($iterator, $closure, $token)
 {
     $ahelper = new AHelper();
     $start = $iterator->current();
     $matchingToken = $ahelper->getNextMatchingToken($iterator, $closure);
     $this->assertTrue($iterator->valid(), 'Iterator is not valid');
     $this->assertSame($start, $iterator->current(), 'Iterator is not at starting-position');
     $this->assertSame($token, $matchingToken);
 }