带有PHPUnit断言的Behat测试

带有PHPUnit断言的Behat测试,phpunit,symfony4,behat,Phpunit,Symfony4,Behat,我在symfony4.3中有一个项目,它使用phpunitbridge5.0,我想在功能测试(behat)中使用断言函数。在较旧的项目中,我使用了PHPUnit包,并要求在behat上下文类中包含以下函数: require_once __DIR__.'/../../vendor/phpunit/phpunit/src/Framework/Assert/Functions.php'; 但PHPUnit Bridge有这样一个类: require_once __DIR__.'/../../bin/

我在symfony4.3中有一个项目,它使用phpunitbridge5.0,我想在功能测试(behat)中使用断言函数。在较旧的项目中,我使用了PHPUnit包,并要求在behat上下文类中包含以下函数:

require_once __DIR__.'/../../vendor/phpunit/phpunit/src/Framework/Assert/Functions.php';
但PHPUnit Bridge有这样一个类:

require_once __DIR__.'/../../bin/.phpunit/phpunit-7.5-0/src/Framework/Assert/Functions.php';
如果我尝试运行测试,则不会更改此选项,而是出现以下错误:

此错误由首次在Functions.php类内部使用引起,该类为:

use PHPUnit\Framework\Assert;
但那个班是存在的,因为我可以亲自去。我在网上寻找一些在这种情况下有用的答案,但这些答案都不起作用。我试过使用:

use PHPUnit_Framework_Assert as Assertions;
// Class which implement that what I need exist too in namespace PHPUnit\Framework with name Assert 
use PHPUnit\Framework\Assert as Assertions; 

我做错了什么??谢谢你的帮助。

我找到了解决办法。如果有人有同样的问题,只需安装phpunit/phpunit组件并忽略PHPUnitBridge发出的警告。然后通过以下方式在behat中使用它:

use PHPUnit\Framework\Assert as Assertions;
use PHPUnit\Framework\Assert as Assertions;