Unit testing SilverStripe Behat抛出错误:在null上调用成员函数manage()(Behat\Testwork\Call\Exception\FatalThroWalleError)
我正在做一个SilverStripe项目。我正在使用Behat为我的应用程序编写行为测试。但是当我运行测试时,控制台中出现了一个错误。以下是我如何为我的项目设置Behat 我创建了一个具有以下定义的要素文件Unit testing SilverStripe Behat抛出错误:在null上调用成员函数manage()(Behat\Testwork\Call\Exception\FatalThroWalleError),unit-testing,silverstripe,behat,silverstripe-4,Unit Testing,Silverstripe,Behat,Silverstripe 4,我正在做一个SilverStripe项目。我正在使用Behat为我的应用程序编写行为测试。但是当我运行测试时,控制台中出现了一个错误。以下是我如何为我的项目设置Behat 我创建了一个具有以下定义的要素文件 Feature: ls In order to see the directory structure As a UNIX user I need to be able to list the current directory's contents Sce
Feature: ls
In order to see the directory structure
As a UNIX user
I need to be able to list the current directory's contents
Scenario: List 2 files in a directory
Given I am in a directory "test"
And I have a file named "foo"
And I have a file named "bar"
When I run "ls"
Then I should get:
"""
bar
foo
"""
这是我的测试课
class FeatureContext extends SilverStripeContext
{
/**
* @Given I am in a directory :arg1
*/
public function iAmInADirectory($arg1)
{
return new PendingException();
}
/**
* @Given I have a file named :arg1
*/
public function iHaveAFileNamed($arg1)
{
return new PendingException();
}
/**
* @When I run :arg1
*/
public function iRun($arg1)
{
return new PendingException();
}
/**
* @Then I should get:
*/
public function iShouldGet(PyStringNode $string)
{
assertEquals(1, 1);
}
}
当我运行这些测试时,我在控制台中收到了以下抱怨
┌─ @BeforeScenario # SilverStripe\Framework\Tests\Behaviour\FeatureContext::before()
│
╳ Fatal error: Call to a member function manage() on null (Behat\Testwork\Call\Exception\FatalThrowableError)
│
我的代码出了什么问题?我怎样才能消除这个错误