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

Support PHPUnit 10.x #1219

Draft
wants to merge 44 commits into
base: 2.0.x
Choose a base branch
from

Conversation

ghostwriter
Copy link
Member

Hey @davedevelopment, (and contributors)

currently working on a Mockery Extension for PHPUnit 10 (which explicitly requires PHP 8.1).


Mockery needs to do a few things:

  • Register a new MockeryExceptionInterface as a "Failure Type" (to be implemented by all Mockery Exception classes)

As of sebastianbergmann/phpunit@74ce5b6, all exceptions thrown in third-party subscribers are ignored.

to communicate to PHPUnit the result of the Mockery Expectation verification; making sure that it is correctly interpreted (as a failure, not as an error) via TestCase::registerFailureType() implemented in sebastianbergmann/phpunit@28766f5 for PHPUnit 10.1.

  • Exclude Mockery Directory via PHPUnit\Util\ExcludeList::addDirectory

  • Add expectations to be verified via TestCase::addToAssertionCount(Mockery::getContainer()->mockery_getExpectationCount()); before the test starts.

  • Verify expectations after the test has finished (checks if Mockery::close() has been called, and let the test fail if it hasn't.)


How does it work:

  • Bootstrap \Mockery\Adapter\Phpunit\Extension class in phpunit.xml or phpunit.xml.dist.
<extensions>
    <bootstrap class="\Mockery\Adapter\Phpunit\Extension"/>
</extensions>
  • Extend \Mockery\Adapter\Phpunit\MockeryTestCase class in your tests.
<?php

declare(strict_types=1);

use Mockery\Adapter\Phpunit\MockeryTestCase;

final class CustomTest extends MockeryTestCase
{
    //  snip
}

Deprecated and removed features:

  • TestListener
  • Testcase::markAsRisky()

Do we have any plans to drop support for older versions of PHP?

  • PHPUnit 10 uses PHP 8.1 features (eg. never return type declarations which would fail on older versions of PHP.)

Should we follow, a similar path as PHPUnit and raise the minimum required version of PHP to 8.1 for Mockery v2?

What's our desired version path for adding Mockery Extension for PHPUnit 10:

  • a new minor (v1.6)
  • a new major (v2.x)

should we resurrect Mockery 2.0 discussion?

Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
@ghostwriter ghostwriter added this to the 2.0.0 milestone Apr 23, 2023
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
@ghostwriter ghostwriter changed the title RFC: Mockery v2.0 with Support PHPUnit >=10.1 and Drop PHP <8.1 Support PHPUnit >=10.1 and Drop PHP <8.1 Apr 30, 2023
@ghostwriter ghostwriter added Major Backwards Incompatible changes Removed for features or functionality that have been removed in this release labels Apr 30, 2023
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
@ghostwriter ghostwriter mentioned this pull request May 1, 2023
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
@ghostwriter ghostwriter self-assigned this May 1, 2023
@ghostwriter ghostwriter added dependencies Pull requests that update a dependency file Added for new features or functionality labels May 1, 2023
@ghostwriter ghostwriter changed the title Support PHPUnit >=10.1 and Drop PHP <8.1 Support PHPUnit 10.1 and higher May 4, 2023
@ghostwriter ghostwriter added the RFC proposal for a larger change label May 4, 2023
@ghostwriter ghostwriter removed the Removed for features or functionality that have been removed in this release label May 9, 2023
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
@ghostwriter ghostwriter changed the title Support PHPUnit 10.1 and higher Support PHPUnit 10.x Aug 1, 2023
@@ -34,12 +34,12 @@
"ext-pcre": "*"
},
"require-dev": {
"phpunit/phpunit": "^8.5 || ^9.6",
"phpunit/phpunit": "^10.1",
Copy link

Choose a reason for hiding this comment

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

Suggested change
"phpunit/phpunit": "^10.1",
"phpunit/phpunit": "^10.1 || ^11",

should we add v11 as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Added for new features or functionality dependencies Pull requests that update a dependency file Major Backwards Incompatible changes RFC proposal for a larger change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants