diff --git a/src/Printer7.php b/src/Printer7.php index 4a10bc1..6ad7a21 100644 --- a/src/Printer7.php +++ b/src/Printer7.php @@ -94,6 +94,13 @@ protected function relativePath(string $path) protected function getReflectionFromTest(string $name) { list($klass, $method) = explode('::', $name); + + // Handle data providers + $parts = explode(" ", $method, 2); + if (count($parts) > 1) { + $method = $parts[0]; + } + $c = new \ReflectionClass($klass); $m = $c->getMethod($method); diff --git a/src/Trait8.php b/src/Trait8.php index 68eee61..0ef2a2f 100644 --- a/src/Trait8.php +++ b/src/Trait8.php @@ -93,6 +93,13 @@ protected function relativePath(string $path) protected function getReflectionFromTest(string $name) { list($klass, $method) = explode('::', $name); + + // Handle data providers + $parts = explode(" ", $method, 2); + if (count($parts) > 1) { + $method = $parts[0]; + } + $c = new \ReflectionClass($klass); $m = $c->getMethod($method); diff --git a/test/_files/PrinterStatesTest.php b/test/_files/PrinterStatesTest.php index 3bb686d..8b32a1a 100644 --- a/test/_files/PrinterStatesTest.php +++ b/test/_files/PrinterStatesTest.php @@ -45,5 +45,20 @@ public function testIncomplete() { $this->markTestIncomplete('Incomplete'); } + + /** + * @dataProvider demoProvider + */ + public function testProvider($v) + { + $this->assertTrue($v); + } + + public function demoProvider() + { + return [ + [false] + ]; + } } diff --git a/test/states-test.phpt b/test/states-test.phpt index 5c9af3b..acf678e 100644 --- a/test/states-test.phpt +++ b/test/states-test.phpt @@ -19,5 +19,6 @@ PHPUnit\TextUI\Command::main(); ::error file=test/_files/PrinterStatesTest.php,line=22::Error: Call to undefined method PrinterStatesTest::isMissing() ::warning file=test/_files/PrinterStatesTest.php,line=32::This is a test warning ::error file=test/_files/PrinterStatesTest.php,line=12::Failed asserting that false is true. +::error file=test/_files/PrinterStatesTest.php,line=54::Failed asserting that false is true. ::warning file=test/_files/PrinterStatesTest.php,line=37::This is a risky test ::warning file=test/_files/PrinterStatesTest.php,line=40::This test did not perform any assertions%0A%0Atest/_files/PrinterStatesTest.php:40