标签: simple-phpunit

如何在 phpunit 测试期间查看完整的警告消息?

终端只告诉我There was 1 Warning:。但是我怎样才能看到完整的警告消息以及它是从哪里触发的呢? 终端截图

--- 这是我的 phpunit.xml 文件

<?xml version="1.0"?>
<phpunit
        colors="true"
        verbose="true"
        stopOnFailure="false"
        convertErrorsToExceptions="true"
        convertNoticesToExceptions="true"
        convertWarningsToExceptions="true"
>
    <testsuites>
        <testsuite name="tests">
            <directory>tests</directory>
        </testsuite>
    </testsuites>
</phpunit>

Run Code Online (Sandbox Code Playgroud)

php phpunit vagrant simple-phpunit

12
推荐指数
1
解决办法
2490
查看次数

PhpUnit 弃用通知:错误猜测内核目录

这是我的 PhpUnit 测试类:

<?php

namespace tests\AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class SendEmailControllerTest extends WebTestCase
{
    public function testMailIsSentAndContentIsCorrect()
    {
        $client = static:: createClient();

        ...
    }
}
Run Code Online (Sandbox Code Playgroud)

但是当我尝试运行它时,我得到了一个错误,其跟踪是:

Unable to guess the Kernel directory.
 C:\myProject\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Test\KernelTestCase.php:62
 C:\myProject\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Test\KernelTestCase.php:138
 C:\myProject\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Test\KernelTestCase.php:184
 C:\myProject\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Test\KernelTestCase.php:165
 C:\myProject\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Test\WebTestCase.php:33
 C:\myProject\tests\AppBundle\Controller\SendEmailControllerTest.php:12

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

Remaining deprecation notices (3)

  1x: Using the KERNEL_DIR environment variable or the automatic guessing based on the phpunit.xml / phpunit.xml.dist file location is deprecated since Symfony 3.4. Set the KERNEL_CLASS environment variable to the fully-qualified class …
Run Code Online (Sandbox Code Playgroud)

php phpunit symfony simple-phpunit

4
推荐指数
2
解决办法
7128
查看次数

Symfony Simple PHPUnit 退出代码 1,未显示错误

我正在 travis ci 上运行一些 PHPUnit 测试,它告诉我它正在以代码 1 退出...我已在本地尝试过此操作,并已确认它正在以代码 1 退出。

问题是,它没有显示任何错误,没有警告,只是弃用。

这是输出

PHPUnit 8.3.5 by Sebastian Bergmann and contributors.

Testing Project Test Suite
...............................................................  63 / 118 ( 53%)
.......................................................         118 / 118 (100%)

Time: 51.24 seconds, Memory: 58.50 MB

OK (118 tests, 444 assertions)

Remaining indirect deprecation notices (13)

  1x: The "DAMA\DoctrineTestBundle\PHPUnit\PHPUnitListener" class implements "PHPUnit\Framework\TestListener" that is deprecated Use the `TestHook` interfaces instead.
    1x in DebugClassLoader::loadClass from Symfony\Component\Debug

  1x: The "DAMA\DoctrineTestBundle\PHPUnit\PHPUnitListener" class uses "PHPUnit\Framework\TestListenerDefaultImplementation" that is deprecated The `TestListener` …
Run Code Online (Sandbox Code Playgroud)

php phpunit symfony symfony-3.4 simple-phpunit

4
推荐指数
1
解决办法
3038
查看次数

使用 phpUnit 运行单个测试

我目前正在我的 Symfony 应用程序中引入测试。其中一些失败了,需要很长时间才能运行它们。

是否可以使用 simpl-phpunit 命令运行单个测试?

我已经测试过:

与我的测试的命名空间,但最终得到

./vendor/bin/simple-phpunit App\tests\Controller\DefaultControllerTest
Run Code Online (Sandbox Code Playgroud)

无法打开文件“ApptestsControllerDefaultControllerTest.php”。

并通过我的测试的相对路径,它会导致:

./vendor/bin/simple-phpunit tests/Controller/DefaultControllerTest
Run Code Online (Sandbox Code Playgroud)

无法打开文件“tests/Controller/DefaultControllerTest.php”。

php phpunit symfony simple-phpunit

2
推荐指数
1
解决办法
3359
查看次数

标签 统计

php ×4

phpunit ×4

simple-phpunit ×4

symfony ×3

symfony-3.4 ×1

vagrant ×1