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

PHP: Fixed incorrect display of skipped tests in the Test Results window for PHPUnit. #7836

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

troizet
Copy link
Collaborator

@troizet troizet commented Oct 7, 2024

Fixed issue #7739.

Example:

<?php

use PHPUnit\Framework\TestCase;

/**
 * Description of testTest
 *
 */
class SkippedTest extends TestCase {

    /**
     * @test
     */
    function testA() {
        self::assertEquals(1, 1);
        return true;
    }


    /**
     * @test
     * @depends testA
     */
    function testA2($varFromTestA) {
        self::assertEquals($varFromTestA, 1);
    }

    /**
     * @test
     */
    function testAB() {
        self::assertEquals(1, 1);
        throw new Exception('This test fails');
    }

    /**
     * @test
     * @depends testAB
     */
    function testAB2($varFromTestA) {
        self::assertEquals($varFromTestA, 1);
    }

    /**
     * @test
     * @depends testAB
     */
    function testAB3($varFromTestA) {
        self::assertEquals($varFromTestA, 1);
    }

    /**
     * @test
     * @skip
     */
    function testSkipped() {
        self::markTestSkipped('Manually skipped');
        self::assertEquals(1, 1);
    }
}

Before:
skipped_tests_before

After:
skipped_tests_after

@troizet troizet added the PHP [ci] enable extra PHP tests (php/php.editor) label Oct 7, 2024
@troizet troizet requested review from tmysik and junichi11 October 7, 2024 13:33
@troizet
Copy link
Collaborator Author

troizet commented Oct 7, 2024

I noticed that if tests have at least one skipped test and no failed tests, all tests are marked as skipped.
I'm not sure if this behavior is correct, but it is independent of the PHPUnit module.
phpunit_all_tests_marked _skipped

Copy link
Member

@tmysik tmysik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SKIPPED status was added later, thanks for fixing it!

Copy link
Member

@junichi11 junichi11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@troizet troizet force-pushed the php_phpunit_skipped_tests branch from 590e51e to f13ac69 Compare October 8, 2024 14:43
@troizet troizet force-pushed the php_phpunit_skipped_tests branch from f13ac69 to c270fac Compare October 8, 2024 15:03
@junichi11 junichi11 added this to the NB24 milestone Oct 8, 2024
@junichi11 junichi11 merged commit 8cab2ae into apache:master Oct 8, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PHP [ci] enable extra PHP tests (php/php.editor)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants