Skip to content

Commit

Permalink
- Close #249.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Nov 9, 2007
1 parent dc277fe commit 8e6ea00
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions PHPUnit/Extensions/SeleniumTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ public static function suite($className)

foreach ($class->getMethods() as $method) {
if (PHPUnit_Framework_TestSuite::isPublicTestMethod($method)) {
$data = PHPUnit_Util_Test::getProvidedData($method);
$groups = PHPUnit_Util_Test::getGroups($method, $classGroups);
$name = $method->getName();
$data = PHPUnit_Util_Test::getProvidedData($className, $name);
$groups = PHPUnit_Util_Test::getGroups($method, $classGroups);

if (isset($staticProperties['browsers'])) {
foreach ($staticProperties['browsers'] as $browser) {
Expand Down
2 changes: 1 addition & 1 deletion PHPUnit/Framework/TestSuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ public static function createTest(ReflectionClass $theClass, $name)

// TestCase($name, $data)
else {
$data = PHPUnit_Util_Test::getProvidedData($method);
$data = PHPUnit_Util_Test::getProvidedData($className, $name);

if (is_array($data) || $data instanceof Iterator) {
$test = new PHPUnit_Framework_TestSuite(
Expand Down
9 changes: 5 additions & 4 deletions PHPUnit/Util/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,21 +212,22 @@ public static function getGroups(Reflector $reflector, array $groups = array())
/**
* Returns the provided data for a method.
*
* @param ReflectionMethod $method
* @param string $className
* @param string $methodName
* @return array
* @access public
* @static
* @since Method available since Release 3.2.0
*/
public static function getProvidedData(ReflectionMethod $method)
public static function getProvidedData($className, $methodName)
{
$method = new ReflectionMethod($className, $methodName);
$docComment = $method->getDocComment();

if (preg_match('/@dataProvider[\s]+([\.\w]+)/', $docComment, $matches)) {
try {
$dataProviderMethod = new ReflectionMethod(
$method->getDeclaringClass()->getName(),
$matches[1]
$className, $matches[1]
);

return $dataProviderMethod->invoke(NULL);
Expand Down

0 comments on commit 8e6ea00

Please sign in to comment.