Я сказал себе: «Я должен научиться bdd?» И я попробовал комбинацию Symfony2/Behat/Mink.
Ну, я писал код, как писал в учебниках. Но все версии behat в документах/учебниках ниже версии 3. Я хочу изучить behat3. Я зайду на официальную страничку и почитаю.
Все в порядке, но почему-то приложение cli не может вызывать расширенные методы класса mink. Я помещу свои коды ниже. Как я запускаю приложение behat3 с помощью методов минка.
особенности/бутстрап/FeatureContext.php
<?php
use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
/**
* Defines application features from the specific context.
*/
class FeatureContext extends \Behat\MinkExtension\Context\MinkContext implements Context, SnippetAcceptingContext
{
}
особенности/home.feature
Feature: Home
I want to see homepage
As a anonym user
Scenario:
Given |I am on |the homepage
Then |I should see text matching "Sektör"
behat.yml
default:
extensions:
Behat\Symfony2Extension: ~
Behat\MinkExtension:
sessions:
default:
symfony2: ~
selenium2:
selenium2: ~
base_url: http://site.dev
композитор.json
"behat/behat": "~3.0",
"behat/mink-extension": "~2.0@dev",
"behat/mink-goutte-driver": "~1.0",
"behat/mink-selenium2-driver": "~1.1",
"behat/symfony2-extension": "*"
Результат:
Feature: Home
I want to see homepage
As a anonym user
Scenario: # features/home.feature:4
Given |I am on |the homepage
Then |I should see text matching "Sektör"
1 scenario (1 undefined)
2 steps (2 undefined)
0m0.12s (25.80Mb)
--- FeatureContext has missing steps. Define them with these snippets:
/**
* @Given |I am on |the homepage
*/
public function iAmOnTheHomepage()
{
throw new PendingException();
}
/**
* @Then |I should see text matching :arg1
*/
public function iShouldSeeTextMatching($arg1)
{
throw new PendingException();
}