Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

markTestSkipped() not handled correctly when called in "before first test" method #5164

Closed
sebastianbergmann opened this issue Feb 4, 2023 · 0 comments
Assignees
Labels
feature/test-runner CLI test runner type/bug Something is broken version/9 Something affects PHPUnit 9

Comments

@sebastianbergmann
Copy link
Owner

ExampleTest.php

<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;

final class ExampleTest extends TestCase
{
    public static function setUpBeforeClass(): void
    {
        self::markTestSkipped('message');
    }
    
    public function testOne(): void
    {
    }
    
    public function testTwo(): void
    {
    }
}

Actual Output

PHPUnit 9.6.2 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.2.2

SS                                                                  2 / 2 (100%)

Time: 00:00.001, Memory: 22.41 MB

There were 2 skipped tests:

1) ExampleTest::testOne
message

/home/sb/ExampleTest.php:8

2) ExampleTest::testTwo
Test skipped because of an error in hook method

OK, but incomplete, skipped, or risky tests!
Tests: 2, Assertions: 0, Skipped: 2.

Expected Output

PHPUnit 9.6.2 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.2.2

SS                                                                  2 / 2 (100%)

Time: 00:00.001, Memory: 22.41 MB

There were 2 skipped tests:

1) ExampleTest::testOne
message

/home/sb/ExampleTest.php:8

2) ExampleTest::testTwo
message

OK, but incomplete, skipped, or risky tests!
Tests: 2, Assertions: 0, Skipped: 2.
@sebastianbergmann sebastianbergmann added type/bug Something is broken feature/test-runner CLI test runner version/9 Something affects PHPUnit 9 labels Feb 4, 2023
@sebastianbergmann sebastianbergmann self-assigned this Feb 4, 2023
sebastianbergmann added a commit that referenced this issue Feb 4, 2023
@sebastianbergmann sebastianbergmann changed the title Message from markTestSkipped() lost for tests 2...N skipped in "before first test" method markTestSkipped() not handled correctly when called in "before first test" method Feb 4, 2023
sebastianbergmann added a commit that referenced this issue Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-runner CLI test runner type/bug Something is broken version/9 Something affects PHPUnit 9
Projects
None yet
Development

No branches or pull requests

1 participant