Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[PhpUnitBridge] Cannot silence no assertions warning when using ExpectDeprecationTrait #41444

Copy link
Copy link
Closed
@ostrolucky

Description

@ostrolucky
Issue body actions

Symfony version(s) affected: 6.0.x-dev fb21447

Description
When Symfony\Bridge\PhpUnit\ExpectDeprecationTrait is used in your PhpUnit test (because one of the test scenario methods in current class are doing deprecations), despite calling $this->expectNotToPerformAssertions();, output of phpunit is changed to warning, compared to no-warning/green output when not using the trait.

How to reproduce
Output for this

use PHPUnit\Framework\TestCase;

class CacheCompatibilityPassTest extends TestCase
{
    public function test(): void
    {
        $this->expectNotToPerformAssertions();
    }
}

is

OK (1 test, 0 assertions)
Process finished with exit code 0

but output for this

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;

class CacheCompatibilityPassTest extends TestCase
{
    use ExpectDeprecationTrait;

    public function test(): void
    {
        $this->expectNotToPerformAssertions();
    }
}

is

This test did not perform any assertions


Time: 00:00.031, Memory: 8.00 MB


OK, but incomplete, skipped, or risky tests!
Tests: 1, Assertions: 0, Risky: 1.
Process finished with exit code 0

Additional context:
Starts happening in doctrine-bundle since doctrine/DoctrineBundle#1352

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.