Phpunit 使用TYPO3测试框架运行单元测试时出现各种错误
我正在尝试使用本地的、基于composer的TYPO3 8.7安装,为我的一些扩展运行单元测试。这是我的作曲家文件:Phpunit 使用TYPO3测试框架运行单元测试时出现各种错误,phpunit,typo3,typo3-8.x,Phpunit,Typo3,Typo3 8.x,我正在尝试使用本地的、基于composer的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
{
"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的哪些部分是在引导过程中初始化的,但它似乎不完整
例如:当我尝试在web文件夹中使用以下命令运行扩展svconnector_csv的单元测试时:
/path/to/php ../vendor/bin/phpunit -c ../vendor/nimut/testing-framework/res/Configuration/UnitTests.xml typo3conf/ext/svconnector_csv/Tests/Unit/
所有测试均失败,报告一个异常,即找不到服务密钥tx_SvConnectorCvu_sv1。在使用“报告”模块检入后端时,服务安装良好
在使用类似命令运行扩展外部_导入测试时,出现了另一个错误,但也是一个问题。我得到了指示TCA未加载的错误
是否可以以任何方式影响引导处理,以确保加载TCA和T3_服务等全局阵列?或者他们应该是,而我在我的设置中遗漏了什么
作为参考,以下是两个扩展的源代码链接:
我也使用这个测试框架。我在GitLab CI中使用它,并使用以下工具运行扩展:
.Build/bin/phpunit -c Configuration/.Build/Tests/UnitTests.xml
My 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>
希望有帮助。测试框架是否有自己的安装,而没有安装该服务?