Skip to content

Commit ff86f7f

Browse files
authored
Merge pull request #12 from alnorth/master
Ensure annotations work on tests that use dataProviders
2 parents e29c11d + f1c088b commit ff86f7f

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

PHPUnit/Util/Log/VCR.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time)
122122
public function startTest(PHPUnit_Framework_Test $test)
123123
{
124124
$class = get_class($test);
125-
$method = $test->getName();
125+
$method = $test->getName(false);
126126

127127
if (!method_exists($class, $method)) {
128128
return;

tests/PHPUnit/Util/Log/VCRTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,23 @@ public function testInterceptsWithAnnotations()
2323
$result = file_get_contents('http://google.com');
2424
$this->assertEquals('This is a annotation test dummy.', $result, 'Call was not intercepted (using annotations).');
2525
}
26+
27+
/**
28+
* @vcr unittest_annotation_test
29+
* @dataProvider aDataProvider
30+
*/
31+
public function testInterceptsWithAnnotationsWhenUsingDataProvider($dummyValue)
32+
{
33+
// Content of tests/fixtures/unittest_annotation_test: "This is a annotation test dummy".
34+
$result = file_get_contents('http://google.com');
35+
$this->assertEquals('This is a annotation test dummy.', $result, 'Call was not intercepted (using annotations with data provider).');
36+
}
37+
38+
public function aDataProvider()
39+
{
40+
return array(
41+
array(1),
42+
array(2)
43+
);
44+
}
2645
}

0 commit comments

Comments
 (0)