-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Feature Request: Add first-class support for PHPUnit #365
Comments
I'd definitely be interested in this depending on the implementation. Tests are good 👍 If a PR isn't too much trouble, then it would be nice to see and try it out. |
Great! I'll start putting together a PR for this very soon then. |
Anything here? |
I’m gonna try to help get this going next week |
Happy to help guys, can also cook in native PHPCS and PHPUnit configuration for Travis CI and codecoverage reporting. Have a look at my repo: https://github.com/koconder/wordpress-test-template and a plugin you can see the Travis CI setup on: https://github.com/koconder/wordpress-test-template Shout if you need me to jump in and build out a PR on-top of any unit tests. |
+1 testing really should be a opt-out. |
Can we help somehow to push this forward? |
#366 was a very good start and it just got stale. @aaemnnosttv are you still interested in reviving that if we provide more support/feedback? If not, someone else can start a new PR based on that one. Looks like the most contentious part of #366 was the usage of |
For what it's worth, I managed to import changes from #366 with slight modifications (mostly to config files, due to shifting from This integration doesn't have to be as simple as |
@mklepaczewski do you want to put up a new PR with those minimal changes? |
Sure, I'll try to prep it within few days. There's not mucg to do there, I'm just quite busy. |
Hello! Any lead on this addition or a working example from @mklepaczewski ? Really interested in adding to my bedrock wp setup! |
Needs more LOVE ❤️. Testing FTW 🥰 |
If I said I'll do it then I'll do it, I don't need to be reminded about it every two years.... ;-) On a more serious note, I scheduled it for the 8th of July. |
Update: I imported changes from #366 into a new branch (it's not released yet) and did some tests. For the most part, it works, but I want to inspect one quirk before I push it. I'm out of time for the task, so it has been rescheduled for July 15th. |
Cheers @mklepaczewski! waiting for your updates! |
Submit a feature request or bug report
Feature Request
Installing, configuring, and running the WordPress core PHPUnit library has always been a pain. This creates an unnecessary barrier for WordPress developers to embrace testing, which is undoubtedly a core component of writing modern web applications.
I've been working on the best way to make the WordPress core PHPUnit library installable via Composer for a while now, and I'm happy to say that it is now just as easy to install as a vanilla Composer package.
I would like to propose the addition of WP PHPUnit to Bedrock's development dependencies, along with the necessary boilerplate for everything else PHPUnit needs to run - including CI configuration. Once Composer dependencies have been installed, and the database created, PHPUnit can be run with a single command out-of-the-box.
I would liken the end goal to be similar to what is part of a fresh installation of Laravel. Structure, dependencies, and a working example test.
Unit tests are not just for plugins/themes. Applications like those built on Bedrock will likely have code which is specific to the application, or not structured as a plugin or theme which should still be tested. Not only that, but testing that your code works as expected in conjunction with all the other dependencies that your application requires is arguably more important than testing that a specific component of it works in isolation.
WP PHPUnit is extremely minimal and is very easy to use compared to the current workflow. It's also fully automated in its maintenance, and completely open-source.
You can see a full working example here: https://github.com/wp-phpunit/example-project
Although this isn't based on Bedrock, the setup is even simpler with Bedrock 😄
If added, WP PHPUnit could be easily removed if undesired without requiring any kind of complicated uninstallation procedure, similar to other components of Bedrock. I think I've made the case that its value as an easily opt-out-able component outweighs the cost one would incur if it were opt-in instead.
Is this something that the team would be receptive to considering a PR for?
Related #106
The text was updated successfully, but these errors were encountered: