0

Symfony でバンドル テストの phpunit テストを実行したいのですが、以下の方法で試しました。

phpunit --verbose src\MyNameSpace\MyAppBundle\Tests\Controller\BadDataPostUnitTestControllerTest

しかし、私が見ているエラー: Fatal error: Class 'Symfony\Bundle\FrameworkBundle\Test\WebTestCase' not found in... where I have used it in my test class

Windowsコマンドプロンプトからコマンドを実行し、Symfonyルートディレクトリからコマンドを実行しています

herethisから解決策を見つけましたが、エラーを取得しようとしているときに。

composer依存関係が存在します。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>
4

0 に答える 0