0
在這個tutorial建議此文件系統:Symfony2 + Behat + Mink:我應該如何重構?
XXXBundle
|---Features
| |----FeaturesContext.php
|---ProductCategoryRelation.feature
其中FeaturesContext.php是存儲
//FeaturesContext.php
/**
* Feature context.
*/
class FeatureContext extends BehatContext
{
/**
* @Given /I have a category "([^"]*)"/
*/
public function iHaveACategory($name)
{
$category = new \Acme\DemoBundle\Entity\Category();
$category->setName($name);
...
而且裏面ProductCategoryRelation.feature建議寫功能的功能和場景文件:
Feature: Product Category Relationship
In order to setup a valid catalog
As a developer
I need a working relationship
This being the feature, we now need the scenarios to be defined.
Scenario: A category contains a product
Given I have a category "Underwear"
...
但是,如果我的應用程序正在成長,應該如何重構例如Fea turesContext.php?