本文介绍了phpunit抛出"PHPUnit_TextUI_ResultPrinter :: __ construct()的参数#3(无值)",该值必须是"never","auto"或“始终"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是在测试Php单元.

I'm just test playing with Php unit.

这是我的DependencyFailureTest类:

Here is my DependencyFailureTest class:

require_once '../vendor/autoload.php';
use PHPUnit\Framework\TestCase;

class DependencyFailureTest extends \PHPUnit\Framework\TestCase
{
    public function testOne()
    {
        $this->assertTrue(false);
    }

    /**
     * @depends testOne
     */
    public function testTwo()
    {
    }
}

但是在运行命令phpunit --verbose DependencyFailureTest时会抛出

But on running the command phpunit --verbose DependencyFailureTest it throws

有人可以对此问题做出解释吗?

Can anybody give an explanation for this issue?

推荐答案

它必须是配置问题.我复制了您的代码,并在命令行中使用详细命令运行了该代码,并且在5.4.6版中运行良好.

It must be a configuration issue. I copied your code and ran it on the command line with verbose and it worked fine with version 5.4.6.

我将重新安装phpunit并确保您具有最新版本.

I would reinstall phpunit and ensure you have the latest version.

此外,他们的入门"页面中的示例测试用例为:

Also, their sample test case from their Getting Started page is:

<?php
use PHPUnit\Framework\TestCase;

class MoneyTest extends TestCase
{
    // ...

    public function testCanBeNegated()
    {
        // Arrange
        $a = new Money(1);

        // Act
        $b = $a->negate();

        // Assert
        $this->assertEquals(-1, $b->getAmount());
    }

    // ...
}

https://phpunit.de/getting-started.html

请注意您的扩展名用法上的差异,尽管我认为这不是问题,但如果您按照说明使用它们的声明,则有助于找出问题所在.

Notice the difference in your extension usage, although I don't think it is an issue, if you use their declaration as stated, it helps to isolate the problem.

这篇关于phpunit抛出"PHPUnit_TextUI_ResultPrinter :: __ construct()的参数#3(无值)",该值必须是"never","auto"或“始终"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 22:47