用Behat模拟添加元素奏鸣曲
Simulate add element Sonata with Behat
我正在使用 sonata admin bundle 来管理我们的 class 并且我正在使用 behat 创建测试以确保一切正常。
但问题是,当我尝试使用 behat 添加新元素时出现此错误:
When I visit the advertisement admin page
And I follow "Add new"
And I fill in "Url" with "http://www.example.com"
And I fill in "Video Source" with "http://www.youtube.com"
And I fill in "Text" with "Test new"
And I press "Create and return to list"
The selected node does not have a form ancestor.
问题是因为这个按钮不合时宜,但这是由 sonata 管理员管理的。
那么有什么方法可以点击这个按钮而不出现这个错误吗?
奏鸣曲的问题是我在表格中有这个元素,但似乎创建了一个不正确的表格:
->add('image', 'sonata_type_model_autocomplete', ['required' => false, 'property' => 'name']);
我换了这个,现在正在工作:
->add('image', 'sonata_type_model_list', ['required' => false]);
我正在使用 sonata admin bundle 来管理我们的 class 并且我正在使用 behat 创建测试以确保一切正常。
但问题是,当我尝试使用 behat 添加新元素时出现此错误:
When I visit the advertisement admin page
And I follow "Add new"
And I fill in "Url" with "http://www.example.com"
And I fill in "Video Source" with "http://www.youtube.com"
And I fill in "Text" with "Test new"
And I press "Create and return to list"
The selected node does not have a form ancestor.
问题是因为这个按钮不合时宜,但这是由 sonata 管理员管理的。
那么有什么方法可以点击这个按钮而不出现这个错误吗?
奏鸣曲的问题是我在表格中有这个元素,但似乎创建了一个不正确的表格:
->add('image', 'sonata_type_model_autocomplete', ['required' => false, 'property' => 'name']);
我换了这个,现在正在工作:
->add('image', 'sonata_type_model_list', ['required' => false]);