首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Symfony 3功能测试错误(KERNEL_DIR或WebTestCase)

Symfony 3功能测试错误(KERNEL_DIR或WebTestCase)
EN

Stack Overflow用户
提问于 2017-07-11 08:41:02
回答 1查看 662关注 0票数 0

我需要在这方面的帮助,文档没有帮助。

我有app/AppKernel.php,我不使用定制内核,但是功能测试不会运行。

phpunit.xml.dist:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
         backupGlobals="false"
         colors="true"
         bootstrap="app/autoload.php"
>
    <php>
        <ini name="error_reporting" value="-1" />
        <server name="KERNEL_DIR" value="app" />
    </php>

    <testsuites>
        <testsuite name="Project Test Suite">
            <directory>tests</directory>
        </testsuite>
    </testsuites>

    <filter>
        <whitelist>
            <directory>src</directory>
            <exclude>
                <directory>src/*Bundle/Resources</directory>
                <directory>src/*/*Bundle/Resources</directory>
                <directory>src/*/Bundle/*Bundle/Resources</directory>
            </exclude>
        </whitelist>
    </filter>
</phpunit>

错误:

代码语言:javascript
复制
/usr/bin/php /home/jorgee/Desktop/Proyectos/Nano/proyecto-nano/vendor/phpunit/phpunit/phpunit --no-configuration /home/jorgee/Desktop/Proyectos/Nano/proyecto-nano/tests --teamcity
Testing started at 21:35 ...
PHPUnit 6.1.0 by Sebastian Bergmann and contributors.


Either set KERNEL_DIR in your phpunit.xml according to https://symfony.com/doc/current/book/testing.html#your-first-functional-test or override the WebTestCase::createKernel() method.
 /home/jorgee/Desktop/Proyectos/Nano/proyecto-nano/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:126
 /home/jorgee/Desktop/Proyectos/Nano/proyecto-nano/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:165
 /home/jorgee/Desktop/Proyectos/Nano/proyecto-nano/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:146
 /home/jorgee/Desktop/Proyectos/Nano/proyecto-nano/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php:33
 /home/jorgee/Desktop/Proyectos/Nano/proyecto-nano/tests/AppBundle/Controller/Security/LoginControllerAcceptanceTest.php:19
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-07-11 13:49:09

您可以使用--no-configuration运行phpunit,这会阻止phpunit加载配置文件。

加载文件,或将KERNEL_DIR设置为环境变量。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45023623

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档