我使用非常酷的knplabs/friendlycontexts包来测试VictoireDCMS,一个 Symfony2 开源 DCMS。
实际上,尽管我的项目是这样的(不是基本的 symfony 项目架构,而是一套带有功能测试应用程序的捆绑包),但它运行得非常好。
但是...我现在被阻止在 EntityContext 中使用 alice 引用。文档给出了这些例子:
用户.yml
App\Entity\User:
user-john:
firstname: John
lastname: Doe
user-admin:
firstname: Admin
lastname: Admin
我的.feature
@alice(User)
Feature: My feature
The feature description
Background:
Given the following products
| name | user |
| Ball | John |
| Shoes | Admin |
...
这真的很好看,这正是我想要做的,这是我的代码:
template.yml (完整文件)
Victoire\Bundle\TemplateBundle\Entity\Template:
template_base:
name: Base
...
my.feature (完整文件)
Given the following page:
| name | slug | locale | template |
| tatooine | tatooine | fr | base |
不幸的是,它无法正常工作,当我运行我的功能时出现此错误:
关联字段“Victoire\Bundle\PageBundle\Entity\BasePage#$template”的“Victoire\Bundle\TemplateBundle\Entity\Template”类型的预期值,改为“string”。(学说\ORM\ORMInvalidArgumentException)
我无法弄清楚这一点,也看不出示例和我的代码有任何区别......任何帮助将不胜感激。