我正在尝试运行 behat,我制作了一个场景大纲,但跳过了一些带有参数的行,并且一些变量被错误地使用了。
这是写在 .feature 上的小黄瓜场景大纲,其中包含已分配的功能:
Scenario Outline: CreatePostUseCase service # tests/integration/BlogApp/Feature/BlogApp.feature:7
Given an <userid> # IntegrationTests\BlogApp\Context\BlogAppContext::aUserId()
And an <email> // <- email row is skipped and no anEmail() function assigned
And a <password> # IntegrationTests\BlogApp\Context\BlogAppContext::aTitle() // <- why is assigning aTitle() in password?
When creating and saving a User object # IntegrationTests\BlogApp\Context\BlogAppContext::creatingAndSavingAUserObject()
Given a <title> // <- why is not assigning aTitle() here?
And a <body> // <- this one is also skipped
When creating a Post object # IntegrationTests\BlogApp\Context\BlogAppContext::creatingAPostObject()
Given a <publish> param # IntegrationTests\BlogApp\Context\BlogAppContext::aPublish()
And persist the Post // <- this one is also skipped
Then an event should be launched # IntegrationTests\BlogApp\Context\BlogAppContext::anEventShouldBeLaunched()
这是上下文:
/**
* @Given an :userid
*/
public function aUserId($userId)
{
$this->userId = $userId;
}
/**
* @And an :email
*/
public function anEmail($email)
{
$this->email = new Email($email);
}
/**
* @And a :password
*/
public function aPassword($password)
{
$this->password = new Password($password);
}
/**
* @When creating and saving a User object
*/
public function creatingAndSavingAUserObject()
{
$this->user = new User($this->userId, $this->email, $this->password);
$this->userRepository = new UserRepository();
$this->userRepository->save($this->user);
}
/**
* @Given a :title
*/
public function aTitle($title)
{
$this->title = $title;
}
/**
* @And a :body
*/
public function aBody($body)
{
$this->body = $body;
}
慕姐4208626
饮歌长啸
随时随地看视频慕课网APP