-
Notifications
You must be signed in to change notification settings - Fork 2
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
Remove WP_Mock #21
Remove WP_Mock #21
Conversation
All new projects will be running on Saluki/Dalmatian. So 7.4 is the only version we care about right now.
ff00fce
to
dd477ad
Compare
- composer remove --dev 10up/wp_mock - composer require --dev php-mock/php-mock-mockery - Manually replaced WP_Mock with PHPMockery WP_Mock has dependencies on older versions of packages. This ends up conflicting with the newer versions of more actively-developed packages. Removing this dependency allows us greater flexibility in the packages we install.
dd477ad
to
8b34a50
Compare
I'd be very reluctant to lose WP_Mock. I know it's just syntactical sugar for things that could be done without it, but I find the PHPMockery approach hard to read at times. The composer issues I'm seeing in PHP 7.4 arise from outdated dependencies in Peridot, which is specifying It looks like Peridot hasn't had a release in > 3 years: https://github.com/peridot-php/peridot/tags. |
Maybe https://github.com/kahlan/kahlan would be a potential Peridot alternative? Peridot is described as "basically a lite version of kahlan with a smaller community and resources behind it" here: peridot-php/peridot#214 |
PHPMockery is just a thin wrapper around Mockery - and we use Mockery whenever we need to mock a class. So personally, I feel like using PHPMockery + Mockery, I'm just keeping one mocking library in my head rather than two.
I didn't realise that. Yes, very happy to replace Peridot + Leo with other things. But I do think On branch
On branch
Do let me know if you're able to install psalm without removing WP_Mock somehow. Because when working with sites that use WP_Mock I was finding that I could only install an older version of psalm that didn't work with PHP 7.4. |
I'm able to have Psalm & WP_Mock installed alongside one another if I remove all the
|
Oh, I stand corrected. I'd still like to avoid having two mocking libraries living in my brain.
|
That makes sense to me. It looks like Kahlan's in-built mocking would be enough to cover anything we'd have used WP_Mock/Mockery/PHPMockery for in the past, so if we could consolidate all those things into one that'd be good 👍 |
Per discussion on ticket #21 Rob and I agreed that replacing Peridot/Leo/WP_Mock with Kahlan would be the best way to allow us to update dependencies and allow installing the latest version of Psalm. Remove peridot dependencies and config file: - rm peridot.php - composer remove --dev peridot-php/peridot peridot-php/leo peridot-php/peridot-dot-reporter 10up/wp_mock - GitHub Actions: Remove peridot test Add Kahlan dependencies and config file: - composer require --dev kahlan/kahlan - Add kahlan-config.php - GitHub Actions: Add kahlan test Leo-to-Kahlan changes: - s/->to->be->an->instanceof/toBeAnInstanceOf/ - s/to->equal/toEqual/ - s/to->contain/toContain/ - s/to->be->empty/toBeEmpty/ - s/to->be->equal/toEqual/ WP_Mock-to-Kahlan changes: - Remove all WP_Mock::setUp and WP_Mock::tearDown - Convert WP_Mock::expectActionAdded to expect() - Convert WP_Mock::wpFunction to allow()/expect() Miscellaneous changes: - Use namespaces in test files - composer update Link: #21
Closing this in favour of #31. |
I think this library has a dependency on an older version of PHPUnit, and some other libraries we're using have dependencies on newer versions of PHPUnit. This is leading to problems. So I want to remove WP_Mock and replace it with PHPMockery.