Skip to content

Commit 7cd75db

Browse files
Merge pull request #1190 from hpbuniat/fix-gethookmethod-with-dataprovider-4.0
Get hook-methods only if a testcase will run
2 parents 96cda9f + 844240c commit 7cd75db

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/Framework/TestSuite.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,12 @@ public function run(PHPUnit_Framework_TestResult $result = null)
630630
return $result;
631631
}
632632

633-
$hookMethods = PHPUnit_Util_Test::getHookMethods($this->name);
633+
// Get hookMethods only if this is a testcase
634+
// Otherwise $this->name may look like UnitTest::testMethod (e.g. when using @dataProvider)
635+
$hookMethods = array();
636+
if ($this->testCase && class_exists($this->name, false)) {
637+
$hookMethods = PHPUnit_Util_Test::getHookMethods($this->name);
638+
}
634639

635640
$result->startTestSuite($this);
636641

0 commit comments

Comments
 (0)