Reputation: 34958
I have the following PHP unit test case.
For checking purposes I commented out the actual test (even with the ->url()
call it does not work)
<?php
class BasicTest extends \PHPUnit_Extensions_Selenium2TestCase
{
static $browsers = array(
'chrome28win7' =>
array(
'browserName' => 'chrome',
'desiredCapabilities' => array(
'version' => '28',
'os' => 'Windows',
'os_version' => '7',
'resolution' => '1280x1024',
),
),
);
/**
* @dataProvider urlDataProvider
* @param $path
*/
public function testUrlScreenshot($path)
{
return; // for checking
$this->url(env('BROWSER_BASE') . $path);
}
public static function urlDataProvider()
{
$list = <<<EOL
datenschutz.html
impressum.html
EOL;
$plainArray = explode("\n", $list);
$result = array();
foreach($plainArray as $entry) {
$result = array($entry);
}
return $result;
}
}
I am getting the following exception:
/usr/bin/php /home/example/local-workspace/example/vendor/phpunit/phpunit/phpunit --configuration /home/example/local-workspace/example/phpunit.xml --filter "/::testUrlScreenshot( .*)?$/" BasicTest /home/example/local-workspace/example/tests/frontend/BasicTest.php --teamcity
Testing started at 10:18 ...
PHP Fatal error: Call to undefined method PHPUnit_Framework_WarningTestCase::setupSpecificBrowser() in /home/example/local-workspace/example/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumBrowserSuite.php on line 95
PHP Stack trace:
PHP 1. {main}() /home/example/local-workspace/example/vendor/phpunit/phpunit/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /home/example/local-workspace/example/vendor/phpunit/phpunit/phpunit:47
PHP 3. PHPUnit_TextUI_Command->run() /home/example/local-workspace/example/vendor/phpunit/phpunit/src/TextUI/Command.php:110
PHP 4. PHPUnit_Runner_BaseTestRunner->getTest() /home/example/local-workspace/example/vendor/phpunit/phpunit/src/TextUI/Command.php:133
PHP 5. ReflectionMethod->invoke() /home/example/local-workspace/example/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php:87
PHP 6. PHPUnit_Extensions_Selenium2TestCase::suite() /home/example/local-workspace/example/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php:87
PHP 7. PHPUnit_Extensions_SeleniumTestSuite::fromTestCaseClass() /home/example/local-workspace/example/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase.php:371
PHP 8. PHPUnit_Extensions_SeleniumBrowserSuite->setupSpecificBrowser() /home/example/local-workspace/example/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumTestSuite.php:142
PHP 9. PHPUnit_Extensions_SeleniumBrowserSuite->browserOnAllTests() /home/example/local-workspace/example/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumBrowserSuite.php:86
PHP 10. PHPUnit_Extensions_SeleniumBrowserSuite->browserOnAllTests() /home/example/local-workspace/example/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumBrowserSuite.php:93
if I do not use the dataProvider annotation, I can run tests. Why is that? Is `@dataProvider
Upvotes: 1
Views: 208
Reputation: 34958
The exception actually covered up another error.
Debugging revealed this:
So PHP Unit raised an error because my dataset was invalid (dataset needs to be an array of arrays), which somehow made PHPUnit trying to call setupSpecificBrowser()
on the exception class.
Fixing the dataset fixed the error.
Upvotes: 1