Example #1
0
 private function createSuite($path, ParsedClass $class)
 {
     return new Suite($path, $this->executableTests($path, $class->getMethods($this->options ? $this->options->annotations : array())), $class->getName());
 }
Example #2
0
 public function testParsedClassWithParentHasCorrectNumberOfTestMethods()
 {
     $this->parseFile($this->errorFile);
     $this->assertEquals(4, sizeof($this->class->getMethods()));
 }
Example #3
0
 /**
  * Get method all available tests.
  *
  * With empty filter this method returns single test if doesnt' have data provider or
  * data provider is not used and return all test if has data provider and data provider is used.
  *
  * @param  ParsedClass  $class            Parsed class.
  * @param  ParsedObject $method           Parsed method.
  * @param  bool         $useDataProvider  Try to use data provider or not.
  * @return string[]     Array of test names.
  */
 private function getMethodTests($class, $method, $useDataProvider = false)
 {
     $result = array();
     $groups = $this->methodGroups($method);
     $dataProvider = $this->methodDataProvider($method);
     if ($useDataProvider && isset($dataProvider)) {
         $testFullClassName = "\\" . $class->getName();
         $testClass = new $testFullClassName();
         $result = array();
         $datasetKeys = array_keys($testClass->{$dataProvider}());
         foreach ($datasetKeys as $key) {
             $test = sprintf("%s with data set %s", $method->getName(), is_int($key) ? "#" . $key : "\"" . $key . "\"");
             if ($this->testMatchOptions($class->getName(), $test, $groups)) {
                 $result[] = $test;
             }
         }
     } elseif ($this->testMatchOptions($class->getName(), $method->getName(), $groups)) {
         $result = array($method->getName());
     }
     return $result;
 }
Example #4
0
 private function classGroups(ParsedClass $class)
 {
     return $this->docBlockGroups($class->getDocBlock());
 }