2017-07-11 4 views
0

私はこれに関する助けが必要です。Symfony 3機能テストエラー(KERNEL_DIRまたはWebTestCase)

私はapp/AppKernel.phpですが、カスタムカーネルは使用しませんが、機能テストは実行されません。

phpunit.xml.dist:

<?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> 

エラー:

/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 
+0

あなたのphpunit.xml.distファイルはどこにありますか? –

答えて

1

あなたが設定ファイルを読み込むからPHPUnitのを防ぐ​​--no-configurationとのPHPUnitを実行します。

ファイルをロードするか、KERNEL_DIRを環境変数として設定します。

+0

ありがとう、私は右クリック→実行してPHPStormを介して実行しています。私はそれを構成できるかどうかを確認します – JorgeeFG