2017-09-30 2 views
3

私のプロジェクトはDoctrine ORMを使用したSymfony 3.3.9プロジェクトです。 私はモジュールDoctrine2でcodeception 2.3.6を使用して、私はこの記事に従います。codeceptionのhttp://codeception.com/docs/modules/Doctrine2codeception:symfony 3.3以降の "doctrine"定義済みサービスの設定は廃止されました。

私の設定は次のとおりです。

#tests/functional.suite.yml 
actor: FunctionalTester 
modules: 
    enabled: 
     - \Helper\Functional 
     - PhpBrowser: 
      url: http://localhost 
     - Symfony 
     - Doctrine2: 
      depends: Symfony 
      cleanup: true 

私は、このコマンド

./vendor/bin/codecept run functional 
とテストスイートを実行すると、

テストは成功と非常によく合いますが、廃止予定のメッセージがスローされます:

"doctrine"を事前に設定するサービスはsymfony 3.3で廃止されました。そして私はfunctional.suite.ymlからDoctrine2モジュールの設定を削除する場合

のSymfony 4.0ではもはやサポートされません私は$I->grabEntityFromRepository()の呼び出しを削除する必要が

#tests/functional.suite.yml 
actor: FunctionalTester 
modules: 
    enabled: 
     - \Helper\Functional 
     - PhpBrowser: 
      url: http://localhost 
     - Symfony 

私のテストクラス、および廃止予定は消える

答えて

4

私のプロジェクトでは同じ問題があります。 問題はgithubで開かれていますhttps://github.com/Codeception/Codeception/issues/4318

問題はDoctrine2のモジュールではなく、symfonyのmoduleにあります。

方法Codeception \モジュール\ symfonyの:: _ getEntityManager()エラーがCodeception \ Libのからトリガーされる3つのサービスの教義を保持したい、doctrine.orm.default_entity_manager、doctrine.dbal.backend_connection

public function _getEntityManager() 
{ 
    if ($this->kernel === null) { 
     $this->fail('Symfony2 platform module is not loaded'); 
    } 
    if (!isset($this->permanentServices[$this->config['em_service']])) { 
     // try to persist configured EM 
     $this->persistService($this->config['em_service'], true); 

     if ($this->_getContainer()->has('doctrine')) { 
      $this->persistService('doctrine', true); 
     } 
     if ($this->_getContainer()->has('doctrine.orm.default_entity_manager')) { 
      $this->persistService('doctrine.orm.default_entity_manager', true); 
     } 
     if ($this->_getContainer()->has('doctrine.dbal.backend_connection')) { 
      $this->persistService('doctrine.dbal.backend_connection', true); 
     } 
    } 
    return $this->permanentServices[$this->config['em_service']]; 
} 

\ Connector \ Symfony :: rebootKernel():

public function rebootKernel() 
{ 
    foreach ($this->persistentServices as $serviceName => $service) { 
     $this->container->set($serviceName, $service); 
    } 
} 

githubの問題をコメントすることができます。現在は閉じられていません。

編集:あなたが設定ファイルにerror_levelを定義し、〜E_USER_DEPRECATEDを追加することができます。

#tests/functional.suite.yml 
actor: FunctionalTester 
modules: 
    enabled: 
     - \Helper\Functional 
     - PhpBrowser: 
      url: http://localhost 
     - Symfony 
     - Doctrine2: 
      depends: Symfony 
      cleanup: true 
error_level: "E_ALL & ~E_STRICT & ~E_DEPRECATED & ~E_USER_DEPRECATED" 

http://codeception.com/docs/04-FunctionalTests#Error-Reporting

+0

ので、この非推奨のメッセージを削除する方法? –

+0

githubで質問できます。 error_level: "E_ALL&〜E_STRICT&〜E_DEPRECATED&〜E_USER_DEPRECATED"をcodeception.ymlファイル – Arno

+0

thxに設定してみてください。本当の解決策はありません。 githubに関する問題があることを知っておいてください;) –

関連する問題