我正在尝试使用本地的、基于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": "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_svconnectorcsv_sv1“的异常。当签入后端时(使用Reports模块),服务安装良好。
在使用类似的命令运行扩展"external_import“的测试时,会出现另一个错误,但也是一个问题。我收到指示TCA未加载的错误。
引导处理是否会受到任何影响,以确保像TCA和T3_SERVICES这样的全局数组被加载?或者应该是,而我在我的设计中遗漏了什么?
作为参考,下面是指向两个扩展的源代码的链接:
发布于 2017-06-18 21:26:40
我也使用这个测试框架。我在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>希望能帮上忙。
https://stackoverflow.com/questions/44616809
复制相似问题