PHPUnit测试...在Symfony中以详细模式运行

时间:2016-07-08 09:08:45

标签: symfony phpunit verbose

我想在Symfony中为我的捆绑测试运行phpunit测试,我尝试过以下方式:

  

phpunit --verbose   SRC \ myNameSpace对象\ MyAppBundle \测试\控制器\ BadDataPostUnitTestControllerTest

但我看到的错误: 致命错误:Class' Symfony \ Bundle \ FrameworkBundle \ Test \ WebTestCase'找不到...我在我的测试类中使用它

我正在从Windows命令提示符运行命令并从Symfony根目录运行命令

我找到了来自herethis的解决方案,但是当我尝试收到错误时。

作曲家依赖项存在,我在composer.json文件中检查过以下行:

,
    "require-dev": {
        "sensio/generator-bundle": "~2.3",
        "phpunit/phpunit": "^4.8",
        "squizlabs/php_codesniffer": "^2.3",
        "phploc/phploc": "^2.1",
        "pdepend/pdepend": "^2.1",
        "phpmd/phpmd": "^2.2",
        "sebastian/phpcpd": "^2.0",
        "theseer/phpdox": "0.8.1.1",
        "symfony/browser-kit": "^2.7",
        "mayflower/php-codebrowser": "^1.1"     
    }

更新: 当--verbose显示错误时,以下命令正常运行: phpunit -c app /src/NameSpace/MyBundle/Tests/Controller/MyUnitTestControllerTest.php

更新:

/app/phpunit.xml文件:

<phpunit backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" syntaxCheck="false" bootstrap="bootstrap.php.cache" codecoverage="true">

    <formatter type="clover" usefile="false"/>
    <testsuites>
        <testsuite name="EDS Console App Test Suite">
            <directory>../src/*/*Bundle/Tests</directory>
            <directory>../src/*/Bundle/*Bundle/Tests</directory>
        </testsuite>
    </testsuites>

    <filter>
        <whitelist>
            <directory>../src</directory>
            <exclude>
                <directory>../src/*/*Bundle/Resources</directory>
                <directory>../src/*/*Bundle/Tests</directory>
                <directory>../src/*/Bundle/*Bundle/Resources</directory>
                <directory>../src/*/Bundle/*Bundle/Tests</directory>
            </exclude>
        </whitelist>
    </filter>

    <php>
        <server name='SERVER_PORT' value='8080' />
        <server name='SERVER_NAME' value='http://myserver.com' />
    </php>

    <logging>
        <log type="coverage-html" target="${basedir}/build/coverage" title="EDL-Console Test  Coverage" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/>
        <log type="coverage-clover" target="${basedir}/build/logs/clover.xml"/>
        <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
    </logging>
</phpunit>

0 个答案:

没有答案