1

使用 TYPO3 10.2 运行 TYPO3 爬虫的单元测试

TYPO3_PATH_WEB=$PWD/.Build/Web typo3DatabaseName=crawler typo3DatabaseHost=127.0.0.1 typo3DatabaseUsername=root typo3DatabasePassword=root .Build/bin/phpunit -c .Build/vendor/nimut/testing-framework/res/Configuration/FunctionalTests.xml Tests/Functional --filter canCreateQueueEntriesUsingConfigurationRecord

我收到以下错误,请参见下文。

如果我将https://github.com/AOEpeople/crawler/blob/typo3v9/Classes/Api/CrawlerApi.php#L76更改 为GeneralUtility::makeInstance()它可以工作,但它$objectManager->get()不起作用。

我知道可以完全删除该行,只是想了解这里的问题所在。我在其中找不到任何逻辑。

要亲自尝试,您可以将 composer.json 中的 require-dev 部分调整为

    "require-dev": {
        "nimut/testing-framework": "^4.1 || dev-master",
        "nimut/typo3-complete": "^9.5 || ^10.2",
        "phpstan/phpstan": "^0.11.19",
        "rector/rector": "^0.6",
        "symplify/easy-coding-standard": "^7.0"
    },

错误

There was 1 error:

1) AOE\Crawler\Tests\Functional\Api\CrawlerApiTest::canCreateQueueEntriesUsingConfigurationRecord
InvalidArgumentException: "\string$filter" is not a valid Fqsen!.

/path/to/extension/crawler/.Build/vendor/phpdocumentor/reflection-common/src/Fqsen.php:48
/path/to/extension/crawler/.Build/vendor/phpdocumentor/type-resolver/src/FqsenResolver.php:70
/path/to/extension/crawler/.Build/vendor/phpdocumentor/type-resolver/src/FqsenResolver.php:32
/path/to/extension/crawler/.Build/vendor/phpdocumentor/type-resolver/src/TypeResolver.php:264
/path/to/extension/crawler/.Build/vendor/phpdocumentor/type-resolver/src/TypeResolver.php:118
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Reflection/ClassSchema.php:401
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Reflection/ClassSchema.php:185
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Reflection/ReflectionService.php:112
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Reflection/ReflectionService.php:99
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Object/Container/Container.php:158
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Object/Container/Container.php:110
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Object/ObjectManager.php:126
/path/to/extension/crawler/Classes/Api/CrawlerApi.php:76
/path/to/extension/crawler/.Build/Web/typo3/sysext/core/Classes/Utility/GeneralUtility.php:3461
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Object/Container/Container.php:193
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Object/Container/Container.php:166
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Object/Container/Container.php:110
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Object/ObjectManager.php:126
/path/to/extension/crawler/Tests/Functional/Api/CrawlerApiTest.php:116
4

1 回答 1

1

问题很可能出现在CrawelerController. ObjectManager分析应该创建的类和所有依赖类。

在这种情况下,文档块中存在格式错误: https ://github.com/AOEpeople/crawler/blob/typo3v9/Classes/Controller/CrawlerController.php#L940

/**
 * Return array of records from crawler queue for input page ID
 *
 * @param integer $id Page ID for which to look up log entries.
 * @param string$filter Filter: "all" => all entries, "pending" => all that is not yet run, "finished" => all complete ones
 * @param boolean $doFlush If TRUE, then entries selected at DELETED(!) instead of selected!
 * @param boolean $doFullFlush
 * @param integer $itemsPerPage Limit the amount of entries per page default is 10
 * @return array
 */
public function getLogEntriesForPageId($id, $filter = '', $doFlush = false, $doFullFlush = false, $itemsPerPage = 10)

之间缺少空格string$filter

于 2019-12-08T13:11:00.450 回答