2016-05-04 11 views
1

次のPHPユニットテストケースがあります。私が使用していない場合はPHPUnit Selenium2Testcaseがデータプロバイダと連携しない

/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 

:私は、私は次の例外を取得しています(でも、それは動作しません->url()呼び出しで)実際の試験

<?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; 
    } 
} 

コメントアウトチェックする目的のために

dataProviderアノテーション、テストを実行できます。何故ですか? Is @dataProvider

答えて

1

例外は実際に別のエラーを隠していました。私のデータセットは何とかPHPUnitのが例外でsetupSpecificBrowser()を呼び出そうと作られた、(データセットは、配列の配列である必要があります)が無効であったため

enter image description here

だから、PHPはユニットがエラーを提起:

デバッグはこのことを明らかにしましたクラス。

データセットを修正すると、エラーが修正されました。

関連する問題