gpt4 book ai didi

php - Codeception 在 Symfony 4 中找不到 Kernel.php

转载 作者:行者123 更新时间:2023-12-02 20:30:07 25 4
gpt4 key购买 nike

我正在尝试使用 Codeception 对使用 Symfony 4 的项目进行一些功能验收测试。项目环境是使用 docker 容器构建的(只是简单的 pgsql 容器和 php 容器,运行 php bin/comnsoleserve 并将 8000 暴露给不同的本地端口)。我遇到了运行使用 symfony 扩展指定的测试会导致错误的问题:

bin/codecept run -v
Codeception PHP Testing Framework v2.4.0
Powered by PHPUnit 7.0.2 by Sebastian Bergmann and contributors.

In Symfony.php line 300:

[Codeception\Exception\ModuleRequireException]
[Symfony] module requirements not met --

Kernel class was not found in /srv/dsp-blacklister/src/Kernel.php. Specify directory where file with Kernel class for your application is located with `app_path` parameter.

但是内核位于那里:

/srv/dsp-blacklister/src # ls -la
total 4
drwxr-xr-x 7 root root 224 Feb 28 09:35 .
drwxr-xr-x 26 root root 832 Feb 28 16:18 ..
drwxr-xr-x 3 root root 96 Feb 28 08:16 Controller
drwxr-xr-x 5 root root 160 Feb 28 10:39 Entity
-rw-r--r-- 1 root root 2010 Feb 28 09:35 Kernel.php
drwxr-xr-x 4 root root 128 Feb 28 11:39 Migrations
drwxr-xr-x 3 root root 96 Feb 28 09:09 Repository

最佳答案

您的内核位于不同的命名空间中。除了下面的临时破解(添加到内核类的底部)之外,还没有解决此问题的方法

class_alias(Kernel::class, 'App\Kernel', true);

关于php - Codeception 在 Symfony 4 中找不到 Kernel.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49046001/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com