如何解决如果“framework.test”配置未设置为 true,则无法创建用于功能测试的客户端
我正在尝试使用 WebTestCase 应用功能测试。
class CalculatorControllerTest extends WebTestCase
{
public function testSumPost()
{
$client = static::createClient();
$client->request('GET','/calculator/sum');
$this->assertEquals(200,$client->getResponse()->getStatusCode());
}
}
我在运行测试时收到以下错误消息:
You cannot create the client used in functional tests if the "framework.test" config is not set to true
我的测试框架:
framework:
test: ~
session:
storage_id: session.storage.mock_file
router:
resource: "%kernel.root_dir%/config/routing_test.yml"
profiler:
collect: false
我的 PHPunit.xml:(我也尝试在 APP_ENV 和 Debug 1 而不是 0 中测试而不是 dev)
<?xml version="1.0" encoding="UTF-8"?>
<PHPunit
backupGlobals = "false"
backupStaticAttributes = "false"
colors = "true"
convertErrorsToExceptions = "true"
convertNoticesToExceptions = "true"
convertWarningsToExceptions = "true"
processIsolation = "false"
stopOnFailure = "false"
bootstrap = "config/bootstrap.PHP" >
<PHP>
<ini name="error_reporting" value="-1" />
<server name="KERNEL_CLASS" value="AppKernel" />
<env name="APP_ENV" value="dev" />
<env name="APP_DEBUG" value="0" />
<env name="SHELL_VERBOSITY" value="-1" />
<!-- define your env variables for the test env here -->
</PHP>
<testsuites>
<testsuite name="Plein Test Suite">
<directory>tests/unit</directory>
</testsuite>
</testsuites>
我查看了所有相关问题,但找不到好的答案,请问有什么想法吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。