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

Cannot mark tests as skipped or incomplete in beforeClass hooks #4689

Copy link
Copy link
Closed
@jderusse

Description

@jderusse
Issue body actions
Q A
PHPUnit version 9.5.2
PHP version 8.0
Installation Method Composer / PHAR

Summary

When calling self::markTestSkipped in a setUpBeforeClass method, all tests inside the file are flagged Skipped without the error "Test skipped because of an error in hook method"

When looking at https://github.com/sebastianbergmann/phpunit/blob/master/src/Framework/TestSuite.php#L438-L448
It looks like we can fix this by throwing a SkippedTestSuiteError instead. But this class is @internal.

Current behavior

1) FooTest::testMethod
Test skipped because of an error in hook method

How to reproduce

class FooTest extends TestCase {
    public static function setUpBeforeClass(): void
    {
        self::markTestSkipped('My Custom message');
    }
}

Expected behavior

1) FooTest::testMethod
My Custom message

Suggestion

Add a public static markTestSuiteSkipped method to the API

Metadata

Metadata

Assignees

No one assigned

    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.