Laravel / codeception问题带有测试注释[Phpunit \ Framework \ Warning]&quot&quot @covers \ testController :: __ construct"无效

发布于 2025-01-21 16:35:17 字数 1252 浏览 2 评论 0原文

我在测试中的@covers注释有问题(诸如:@doesnotperformassertions这样的注释很好)。

codeception.sh无所事事...主要是在沙盒中进行测试。

php:

php -v
PHP 8.1.4 (cli) (built: Apr  4 2022 13:30:17) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.4, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.4, Copyright (c), by Zend Technologies
    with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans

框架: Laravel Framework 9.8.1

这是虚拟测试来源:

namespace Tests\Unit\Http\Controllers;
 
use App\Http\Controllers\TestController; 
use Codeception\Test\Unit;

class TestController_Test extends Unit {

     private static $O;

     public function _before()
     {
         self::$O = new TestController();
     }
 
     /**
     * @covers \TestController::__construct
     */
     public function testIndex()
     {
         // Dummy...
         $this->assertNotEmpty(self::$O->index());
     }
}

我不知道为什么@coves根本不适合我。任何帮助将不胜感激。有没有类似问题的人?

我编辑了错字。 因此,@covers在我的测试中不起作用。 :(

I have problem with @covers annotation in tests (annotations like: @doesNotPerformAssertions works fine).

enter image description here

codeception.sh do nothing special... mostly just put test in sandbox.

PHP:

php -v
PHP 8.1.4 (cli) (built: Apr  4 2022 13:30:17) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.4, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.4, Copyright (c), by Zend Technologies
    with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans

Framework:
Laravel Framework 9.8.1

Here is the dummy test source:

namespace Tests\Unit\Http\Controllers;
 
use App\Http\Controllers\TestController; 
use Codeception\Test\Unit;

class TestController_Test extends Unit {

     private static $O;

     public function _before()
     {
         self::$O = new TestController();
     }
 
     /**
     * @covers \TestController::__construct
     */
     public function testIndex()
     {
         // Dummy...
         $this->assertNotEmpty(self::$O->index());
     }
}

I have no idea why @coves not works for me at all. Any help would be appreciated. Is there anyone who had similar problem?

I edited typo.
So, @covers not work in my tests. :(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文