一位同事想在测试中模拟实体经理。他有以下代码: ... $em = $this->createMock(EntityManager::class); $myRepository = new NewslettersStatisticSnapshotRepository( $em, NewslettersStatisticSnapshot::class ); $em->method('getRepository')->willReturn($myRepository); ......当我运行他的测试时,我得到了:TypeError:传递给Doctrine \ ORM \ EntityRepository :: __ construct()的参数2必须是Doctrine \ ORM \ Mapping \ ClassMetadata的实例,给定字符串我如何为该类挖掘元数据?
添加回答
举报
0/150
提交
取消