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

Provide PHP 5.6 / PHPUnit 5.7.27 support #947

Merged

Conversation

MKodde
Copy link
Contributor

@MKodde MKodde commented Feb 13, 2019

The current combination of PHPUnit 5.7.27 with Mockery 1.2.1 cause fatal errors which are described in detail in #946. This PR addresses the two issues described in the aforementioned issue.

The commit messages will link to relevant sources and explain the proposed fixes in higher detail.

In order to support older versions (in my case 5.7.27) of PHPUnit which
we state we support (~5.7.10|~6.5|~7.0|~8.0), we can not use PHP 7
language constructions, for chances are these users are also using an
ancient version of PHP < 7.

By simply removing the strict types declaration PHP 5 users should no
longer encounter any problems.
In order to work with older PHPUnit versions (<6), Mockery provides
some cool Legacy support adapters. The TestListenerTrait for example
creates class aliasses in order to autoload the used classes the same
way between PHPUnit versions.

PHPUnit also provides some forwards compatibilty support in the later
5.7 releases. These support features are not fully in sync and will
cause a class not found exception when running tests on older PHP
versions. The least breaking fix is the one I'm suggesting in this
commit. It should work for older PHPUnit versions and also for the
latest 5.7.27.

https://github.com/sebastianbergmann/phpunit/tree/5.7.27/src/ForwardCompatibility
@BackEndTea
Copy link

A bigger worry here is that travis did not pick up this bc break. Its worth looking into how it is possible that it got through without CI telling us about the BC break

Copy link

@BackEndTea BackEndTea left a comment

Choose a reason for hiding this comment

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

👍

@davedevelopment
Copy link
Collaborator

Thank you for the patch, will merge.

@BackEndTea In terms of Travis not picking it up, I'm not sure. (https://travis-ci.org/mockery/mockery/jobs/489002164)[This run] (PHP 5.6.32, PHPUnit 5.7.27) warned about the strict types declaration, but didn't fail around the second problem, I'd assume because of the order the autoloader picked things up?

We're supporting 4 major versions of PHPUnit, and numerous major versions of PHP, things will undoubtedly slip through the net.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants