Exemplo n.º 1
0
 /**
  * @dataProvider classesInput
  */
 public function testClassesCompletion($line, $expect)
 {
     $context = new Context();
     $commands = array(new ShowCommand(), new ListCommand());
     $matchers = array(new Matcher\VariablesMatcher(), new Matcher\ClassNamesMatcher(), new Matcher\ConstantsMatcher(), new Matcher\FunctionsMatcher(), new Matcher\ObjectMethodsMatcher(), new Matcher\ObjectAttributesMatcher(), new Matcher\KeywordsMatcher(), new Matcher\ClassAttributesMatcher(), new Matcher\ClassMethodsMatcher(), new Matcher\CommandsMatcher($commands));
     $config = new Configuration();
     $tabCompletion = $config->getAutoCompleter();
     foreach ($matchers as $matcher) {
         if ($matcher instanceof ContextAware) {
             $matcher->setContext($context);
         }
         $tabCompletion->addMatcher($matcher);
     }
     $context->setAll(array('foo' => 12, 'bar' => new \DOMDocument()));
     $code = $tabCompletion->processCallback('', 0, array('line_buffer' => $line, 'point' => 0, 'end' => strlen($line)));
     $this->assertContains($expect, $code);
 }