PHPUnit @dataProvider simply doesn't work

前端 未结 8 1744
后悔当初
后悔当初 2021-02-01 16:04

I\'ve read the documentation on the topic, and my code follows all requirements of a data provider implementation. First of all, here\'s the full code of the test just in case i

8条回答
  •  北海茫月
    2021-02-01 16:37

    Hello to anyone still getting here from google :) I'm using PHP 7.0.5 and PHPUnit 5.3.2.

    As @hubro mentions - don't use __construct() as it breaks some PHPUnit annotations. Here is a SO tread with more details.

    My test's class, MyStuffTest, extends MyFancyTestcase which extends PHPUnit_Framework_TestCase. MyFancyTestcase used __construct() and I got the same error. It should use setupBeforeClass() instead to setup static data shared among all test cases - db connection and such, no need for __construct(). DataProvider works now.

提交回复
热议问题