我正在尝试使用基于本地,基于作曲家的TYPO3 8.7安装来运行部分扩展的单元测试。这是我的作曲家档案:
{
"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"使用(在" web"文件夹中):
/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 :(得分: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>
希望,这有帮助。