Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[PhpUnitBridge] Fix expectDeprecation() in isolation#37515

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@alexpott
Copy link
Contributor

@alexpottalexpott commentedJul 7, 2020
edited
Loading

QA
Branch?5.1
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix #...
LicenseMIT
Doc PRsymfony/symfony-docs#...

Tests like

    /**     * Do not remove this test in the next major version.     *     * @group legacy     * @runInSeparateProcess     */    public function testOneInIsolation()    {        $this->expectDeprecation('foo');        @trigger_error('foo', E_USER_DEPRECATED);    }

will fail due to:

Testing Symfony\Bridge\PhpUnit\Tests\ExpectDeprecationTraitTestR                                                                   1 / 1 (100%)RTime: 111 ms, Memory: 6.00 MBThere were 2 risky tests:1) Symfony\Bridge\PhpUnit\Tests\ExpectDeprecationTraitTest::testOneInIsolationThis test did not perform any assertions/Users/alex/dev/symfony/src/Symfony/Bridge/PhpUnit/Tests/ExpectDeprecationTraitTest.php:382) Symfony\Bridge\PhpUnit\Tests\ExpectDeprecationTraitTest::testOneInIsolationThis test did not perform any assertionsOK, but incomplete, skipped, or risky tests!Tests: 1, Assertions: 0, Risky: 2.

@alexpott
Copy link
ContributorAuthor

The problem with the fix is that now the assertion count is wrong for tests not run in a separate process.

For example:

./phpunit src/Symfony/Bridge/PhpUnit/Tests/ExpectDeprecationTraitTest.php --filter testOneWithAnnotation                                                                                                             #!/usr/bin/env phpPHPUnit 8.3.5 by Sebastian Bergmann and contributors.Testing Symfony\Bridge\PhpUnit\Tests\ExpectDeprecationTraitTest.                                                                   1 / 1 (100%)Time: 52 ms, Memory: 6.00 MBOK (1 test, 3 assertions)

Before this change it wasOK (1 test, 2 assertions)

@alexpottalexpottforce-pushed theexpect-deprecations-in-isolation branch from0e1e77a toc781eebCompareJuly 7, 2020 17:27
@alexpottalexpott changed the base branch frommaster to5.1July 7, 2020 17:28
@alexpott
Copy link
ContributorAuthor

Actually this has unearthed a significant but in the symfony expectDeprecation method in isolated tests - if you change the expectation to any value it'll still work because essentially the expectation is ignored.

    /**     * Do not remove this test in the next major version.     *     * @group legacy     * @runInSeparateProcess     */    public function testOneInIsolation()    {        $this->expectDeprecation('fdfdef2');        @trigger_error('foo', E_USER_DEPRECATED);    }

will happily pass.

@nicolas-grekasnicolas-grekas added this to the5.1 milestoneJul 8, 2020
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

thanks for working on this!

@nicolas-grekasnicolas-grekas changed the titleExpect deprecations in isolation[PhpUnitBridge] Expect deprecations in isolationJul 9, 2020
@nicolas-grekasnicolas-grekas changed the title[PhpUnitBridge] Expect deprecations in isolation[PhpUnitBridge] Fi expectDeprecation() in isolationJul 9, 2020
@nicolas-grekasnicolas-grekas changed the title[PhpUnitBridge] Fi expectDeprecation() in isolation[PhpUnitBridge] Fix expectDeprecation() in isolationJul 9, 2020
@nicolas-grekas
Copy link
Member

Thank you@alexpott.

@nicolas-grekasnicolas-grekasforce-pushed theexpect-deprecations-in-isolation branch fromc6a5d7c toe7e2ee7CompareJuly 9, 2020 08:07
@nicolas-grekasnicolas-grekas merged commit5992bf0 intosymfony:5.1Jul 9, 2020
@fabpotfabpot mentioned this pull requestJul 24, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@dunglasdunglasAwaiting requested review from dunglas

@jderussejderusseAwaiting requested review from jderusse

@lyrixxlyrixxAwaiting requested review from lyrixx

@srozesrozeAwaiting requested review from sroze

@xabbuhxabbuhAwaiting requested review from xabbuh

@stofstofAwaiting requested review from stof

Assignees

No one assigned

Projects

None yet

Milestone

5.1

Development

Successfully merging this pull request may close these issues.

4 participants

@alexpott@nicolas-grekas@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp