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

Deprecations about drop support Metadata doc-comment in PHPUnit 12 #1359

Closed
kur4tor opened this issue Feb 22, 2024 · 2 comments · Fixed by #1386
Closed

Deprecations about drop support Metadata doc-comment in PHPUnit 12 #1359

kur4tor opened this issue Feb 22, 2024 · 2 comments · Fixed by #1386
Assignees
Labels
Feature Request request a new feature
Milestone

Comments

@kur4tor
Copy link

kur4tor commented Feb 22, 2024

Mockery Version

1.6.7

PHP Version

PHP 8.3

Issue Description

When run tests on latest PHPUnit 11.0.3 with latest mockery version the results return deprecation messages about using annotations and this support will be drop in PHPUnit 12

Steps to Reproduce

Run tests on latest stable PHPUnit will return on each tests when is mockery used

1) Metadata found in doc-comment for method App\Tests\SomeTest::startMockery(). Metadata in doc-comments is deprecated and will no longer be supported in PHPUnit 12. Update your test code to use attributes instead.

2) Metadata found in doc-comment for method App\Tests\SomeTest::purgeMockeryContainer(). Metadata in doc-comments is deprecated and will no longer be supported in PHPUnit 12. Update your test code to use attributes instead.

Expected Behavior

no deprecations

Actual Behavior

No response

Exception or Error

No response

Additional Information

Is all about @before and @after annotations.. for example this on line 62 in MockeryPHPUnitIntegration.php

    /**
     * @before
     */
    protected function startMockery()
    {
        $this->mockeryOpen = true;
    }

    /**
     * @after
     */
    protected function purgeMockeryContainer()
    {
        if ($this->mockeryOpen) {
            // post conditions wasn't called, so test probably failed
            Mockery::close();
        }
    }
@kur4tor kur4tor added the triage needs to be triaged label Feb 22, 2024
@ghostwriter ghostwriter self-assigned this Feb 22, 2024
@ghostwriter ghostwriter added Chore for non-functional changes or maintenance tasks such as code cleanup, formatting, or dependency upda and removed triage needs to be triaged labels Feb 22, 2024
@ghostwriter
Copy link
Member

Hey @kur4tor,

Thank you for letting us know, we will take care of this issue.

ruudk added a commit to ruudk/mockery that referenced this issue Mar 1, 2024
Fixes mockery#1359

While upgrading to PHPUnit 11 I noticed the following deprecation:

Metadata in doc-comments is deprecated and will no longer be supported in PHPUnit 12.
Update your test code to use attributes instead.

If we add the attribute too, it stops complaining. So this most be a way to support PHPUnit 11
and older versions.

If we ship this, we reduce a few errors. Most of the things just work fine.
@ruudk
Copy link
Contributor

ruudk commented Mar 1, 2024

Created a PR to address the issue:

@ghostwriter ghostwriter added the Feature Request request a new feature label Mar 12, 2024
@ghostwriter ghostwriter removed the Chore for non-functional changes or maintenance tasks such as code cleanup, formatting, or dependency upda label Mar 21, 2024
@ghostwriter ghostwriter added this to the 1.6.8 milestone Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request request a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants