PHPUnit_Framework_TestSuite::addTestMethod PHP Method

addTestMethod() protected method

protected addTestMethod ( ReflectionClass $class, ReflectionMethod $method )
$class ReflectionClass
$method ReflectionMethod
    protected function addTestMethod(ReflectionClass $class, ReflectionMethod $method)
    {
        if (!$this->isTestMethod($method)) {
            return;
        }
        $name = $method->getName();
        if (!$method->isPublic()) {
            $this->addTest(self::warning(sprintf('Test method "%s" in test class "%s" is not public.', $name, $class->getName())));
            return;
        }
        $test = self::createTest($class, $name);
        if ($test instanceof PHPUnit_Framework_TestCase || $test instanceof PHPUnit_Framework_TestSuite_DataProvider) {
            $test->setDependencies(PHPUnit_Util_Test::getDependencies($class->getName(), $name));
        }
        $this->addTest($test, PHPUnit_Util_Test::getGroups($class->getName(), $name));
    }

Usage Example

 /**
  * @param ReflectionClass  $class
  * @param ReflectionMethod $method
  * @param array            $names
  */
 protected function addTestMethod(ReflectionClass $class, ReflectionMethod $method, array &$names)
 {
     if ($this->config->inMethodsToBeTested($class->getName(), $method->getName())) {
         parent::addTestMethod($class, $method, $names);
     }
 }
All Usage Examples Of PHPUnit_Framework_TestSuite::addTestMethod