相关疑难解决方法(0)

PHPUnit @dataProvider根本不起作用

我已阅读有关该主题的文档,我的代码遵循数据提供程序实现的所有要求.首先,这是测试的完整代码,以防它相关.

这是实现数据提供者的功能:

/**
 * Test the createGroup function
 *
 * @return void
 * @author Tomas Sandven <tomas191191@gmail.com>
 *
 * @dataProvider provideFileImportTests_good
 **/
public function testCreateGroup($file, $groupname, $group, $mapping)
{
    // Create a test group
    $id = $this->odm->createGroup($groupname, $group);

    // Try to load it back out
    $result = R::load(OmniDataManager::TABLE_GROUP, $id);

    // Check that the result is not null
    $this->assertFalse(is_null($result));

    return $id;
}
Run Code Online (Sandbox Code Playgroud)

PHPUnit失败了:

缺少参数1 for tests\broadnet\broadmap\OmniDataManagerTest :: testCreateGroup()

我试过杀死die();数据提供程序函数中的application(),它永远不会发生.数据提供程序函数在同一个类中公开可用,函数名中没有拼写错误,函数testCreateGroup在注释的注释中引用它,但从不调用数据提供程序函数.

请解释原因

谢谢

php phpunit

28
推荐指数
5
解决办法
9829
查看次数

标签 统计

php ×1

phpunit ×1