2017-06-18 150 views
0

我試圖使用本地,基於作曲者的TYPO3 8.7安裝來運行我的一些擴展的單元測試。這是我的作曲文件:使用TYPO3測試框架運行單元測試的各種錯誤

{ 
    "repositories": [ 
    { "type": "vcs", "url": "https://git.typo3.org/Packages/TYPO3.CMS.git" }, 
    { "type": "vcs", "url": "https://github.com/cobwebch/external_import.git"}, 
    { "type": "vcs", "url": "https://github.com/fsuter/externalimport_test.git"}, 
    { "type": "vcs", "url": "https://github.com/cobwebch/svconnector.git"}, 
    { "type": "vcs", "url": "https://github.com/cobwebch/svconnector_csv.git"}, 
    { "type": "vcs", "url": "https://github.com/cobwebch/svconnector_feed.git"}, 
    { "type": "vcs", "url": "https://github.com/cobwebch/svconnector_json.git"}, 
    { "type": "vcs", "url": "https://github.com/cobwebch/svconnector_sql.git"} 
    ], 
    "name": "my-vendor/my-typo3-cms-distribution", 
    "require": { 
    "typo3/cms": "TYPO3_8-7-dev", 
    "cobweb/external_import": "dev-wombat", 
    "cobweb/externalimport_test": "dev-master", 
    "cobweb/svconnector": "dev-master", 
    "cobweb/svconnector_csv": "dev-master", 
    "cobweb/svconnector_feed": "dev-master", 
    "cobweb/svconnector_json": "dev-master", 
    "cobweb/svconnector_sql": "dev-master" 
    }, 
    "extra": { 
    "typo3/cms": { 
     "cms-package-dir": "{$vendor-dir}/typo3/cms", 
     "web-dir": "web" 
    } 
    }, 
    "require-dev": { 
    "nimut/testing-framework": "^1.1" 
    } 
} 

我完全不明白這TYPO3的部分在引導過程中,同時運行在命令行的單元測試初始化​​,但似乎不完整的。

個例子:當我試圖運行擴展名爲「svconnector_csv」使用單元測試(在「網絡」文件夾中):

/path/to/php ../vendor/bin/phpunit -c ../vendor/nimut/testing-framework/res/Configuration/UnitTests.xml typo3conf/ext/svconnector_csv/Tests/Unit/ 

所有測試失敗,報告異常,沒有服務密鑰「tx_svconnectorcsv_sv1 「 可以被找尋到。在後端檢入時使用該服務安裝正確(使用報告模塊)。

使用類似命令運行擴展名爲「external_import」的測試時出現另一個錯誤,但也是一個問題。我收到錯誤,指出TCA未加載。

能否以任何方式影響所處理的引導,以確保像TCA和T3_SERVICES這樣的全局數組被加載?或者他們應該和我錯過了我的設置中的東西?

作爲參考,這裏的鏈接到兩個擴展的源代碼:

+0

難道是測試框架有自己的安裝沒有安裝該服務? – hakre

回答

0

我用這個測試的框架,太。我用它在GitLab CI與運行我的分機:

.Build/bin/phpunit -c Configuration/.Build/Tests/UnitTests.xml 

我UnitTests.xml:

<phpunit 
    backupGlobals="true" 
    backupStaticAttributes="false" 
    bootstrap="../../../.Build/vendor/nimut/testing-framework/src/TestingFramework/Bootstrap/UnitTestsBootstrap.php" 
    colors="true" 
    convertErrorsToExceptions="true" 
    convertWarningsToExceptions="true" 
    forceCoversAnnotation="false" 
    processIsolation="false" 
    stopOnError="false" 
    stopOnFailure="false" 
    stopOnIncomplete="false" 
    stopOnSkipped="false" 
    verbose="false" 
> 
    <testsuites> 
     <testsuite name="Base tests"> 
      <directory>../../../Tests/Unit</directory> 
     </testsuite> 
    </testsuites> 
</phpunit> 

希望,它幫助。

+0

同樣的結果,但無論如何感謝。 –