我在behat.yml
中定义了两个套件,当我尝试运行bin/behat --suite=system
时出现以下错误:
PHP Fatal error: Cannot redeclare class SystemContext in /Applications/MAMP/htdocs/test.dev/features/bootstrap/SystemContex.php on line 12
我使用了this howto。我的IDE说在其他任何地方都没有出现过这个类。所以我想它会尝试两次调用上下文文件 - 但为什么呢?
behat.yml
default:
suites:
site:
paths: [ %paths.base%/features/site ]
contexts: [ SiteContext ]
system:
paths: [ %paths.base%/features/system ]
contexts: [ SystemContex ]
extensions:
MageTest\MagentoExtension\Extension: ~
Behat\MinkExtension:
base_url: 'http://test.dev/'
selenium2:
wd_host: http://127.0.0.1:4444/wd/hub
browser: firefox
check_baseurl.feature
Feature: Testing that behat and magento are working together
In order to continue working on Magento
As a magento developer
I need to be able to configure behat and magento
Scenario: Base URL is configured in the database
Given there is a base_url configuration option set
Then I should see the value being "http://test.dev/"
SystemContext.php
use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use MageTest\MagentoExtension\Context\MagentoContext;
/**
* Defines application features from the specific context.
*/
class SystemContext extends MagentoContext implements Context, SnippetAcceptingContext {
private $baseUrl;
/**
* @Given there is a base_url configuration option set
*/
public function thereIsABaseUrlConfigurationOptionSet() {
$this->baseUrl = Mage::getBaseUrl();
}
/**
* @Then I should see the value being :arg1
*/
public function iShouldSeeTheValueBeing($arg1) {
expect($this->baseUrl)->toBe($arg1);
}
}