2016-01-20 82 views
1

當我使用Yii2運行單元測試時,我從代碼aspectmock供應商處得到了一些錯誤。消息顯示如下AspectMock無法解析一些文件

[RuntimeException的]
AspectMock無法分析一些文件。
嘗試從解析列表中排除它們。
這個例外有以下原因:
函數trait_exists被重新聲明(之前在文件/var/www/html/myproject/vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Generator.php中聲明) 。

我知道消息的意思,但不知道如何解決它。有沒有人有解決它的經驗?

+0

回報您的問題在https://github.com/Codeception/AspectMock/issues – Naktibalda

回答

1

因爲這裏還沒有回答,並且在他們的github頁面上,當你初始化AspectMock \ Kernel時,將它排除在你的bootstrap.php文件中。

$kernel->init(
    [ 
     'appDir' => $include_path, 
     // Set the path to the class files. 
     'includePaths' => [$include_path], 
     // Exclude out phpunit tests otherwise aspect mock could have issues properly forming mocks. 
     'excludePaths' => [ 
      // add files here 
     ], 
    ] 
); 

git hub