安装symfony/phpunit-bridge
后,我在项目上运行PHPUnit。我正在将Symfony 2.8应用程序升级到Symfony 3.4 LTS。
我收到以下弃用通知:
4x: The Symfony\Component\Validator\ValidatorInterface::validate method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.
4x in CourseTest::testRegexAssertion from CRMPiccoBundle\Tests\Entity
4x: The "deep" option for the Valid constraint is deprecated since Symfony 2.5 and will be removed in 3.0. When traversing arrays, nested arrays are always traversed. When traversing nested objects, their traversal strategy is used.
4x in CourseTest::testRegexAssertion from CRMPiccoBundle\Tests\Entity
在我的服务定义中,我将验证器设置如下:
calls:
- [setValidator, ['@validator']]
当我查看“验证程序”的Symfony服务定义时,可以看到以下内容:
<parameter key="validator.class">Symfony\Component\Validator\Validator\ValidatorInterface</parameter>
<service id="validator" class="%validator.class%">
<factory service="validator.builder" method="getValidator" />
</service>
但是在我使用验证器的班级中,我看到的验证器输出为Symfony\Component\Validator\Validator\RecursiveValidator
-我不知道为什么?
use Symfony\Component\Validator\Validator\ValidatorInterface;
/**
* @param ValidatorInterface $validator
*/
public function setValidator(ValidatorInterface $validator)
{
dump(get_class($validator));
$this->validator = $validator;
}
我还没有升级到Symfony 3.4,所以我仍然在2.8.36上,打算在升级之前先进行折旧工作。