0

我正在尝试使用本地的、基于作曲家的 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”的异常。签入后端(使用报告模块)时,服务安装良好。

另一个错误,但也是一个问题,当使用类似的命令运行扩展“external_import”的测试时。我收到错误提示 TCA 未加载。

是否可以以任何方式影响已处理的引导程序以确保加载 TCA 和 T3_SERVICES 等全局数组?或者他们应该是,我在我的设置中遗漏了一些东西?

作为参考,这是两个扩展的源代码的链接:

4

1 回答 1

1

我也使用这个测试框架。我在 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>

希望能帮助到你。

于 2017-06-18T21:26:40.723 回答