Open mrdavidlaing opened 11 years ago
good info on this stackoverflow question: Unit Testing WordPress Plugins [closed]
Also I think falls into this issue is the conundrum of access to the wordpress core files for IDE code hints. What about read only synonymous links? The coder then would have access to the IDE code hints but wouldn't be able to edit the core files.
Great resource, will digest properly later. :+1:
In the .NET world you can tell you editor to look for source code in a separate place from where it is running. I wonder if this is possible in IDE's like Netbeans?
I had a quick look and couldn't immediately see anything. Think netbeans/eclipse/phpstorm/sublime/dreamweaver would be our main target IDE's.
Also if your busy on another issue, and the rakefile gets merged, then I could take this issue. Unit testing from a wp pov is something I'm going to be learning over the next week either way.
In wordphing there's phing wp-doc
, this gave me the idea of providing phpdocs of the current core files. Finally phpdoc released phpDocumentor2, in fact we may not even need phing, but will require pear and a rake task to build the docs.
The documentation could be served at: http://localhost:4567/docs If in future releases we allow the dev to change the core then a script inside the vm could be run to rebuild it (phpdocs) - maybe a ruby script http://localhost:4567/docs/build.rb (would then call rake:task_build_docs)
My research of netbeans makes it unfeasible to provide code hints and couldn't find option to reference core files outside of project folder. Here is there code completion tutorial Netbeans Code Completion Also to note the phpdoc suggestion allows reference to project and core files for all dev's - IDE independant
@daithi-coombes, I think your ideas around documentation / code completion are a great idea.
However, I've extracted them into a new issue, since it can proceed independently of automated testing.
have put a setup on my host to see how we could integrate the wp unit tests and have had some success... I have a test case for autoflow that extends the WP_UnitTestCase class: https://github.com/daithi-coombes/autoflow-tests/blob/master/autoflowTests.php
The unit tests are at: http://make.wordpress.org/core/handbook/automated-testing/ so our build task for setting up unit testing would go something like:
#get unit tests
svn co https://unit-tests.svn.wordpress.org/trunk /home/vagrant/bin/wordpress-tests
#remove plugin/theme dir's and link to ~/dist plugin/theme dirs
cd /home/vagrant/bin/wordpress-tests/unit-tests/wordpress/wp-content
rm -rf plugins
ln -s /home/vagrant/dist/wp-content/plugins plugins
so now the wp-unit-tests will always be running against the dev's plugins/themes, only issue is calling it is not the prettiest...
cd plugin/tests
phpunit -c /home/vagrant/bin/wordpress-tests/unit-tests/phpunit.xml.dist ./pluginTest.php
but I'm sure we can clean it up? Don't see how we can't end up with:
vagrant ssh
$ rake run unit-test plugin myPlugin
or even better use a web gui: https://github.com/NSinopoli/VisualPHPUnit
http://localhost:4567/unit-test/?plugin=$plugin_name
or
http://localhost:4567/unit-test/?theme=$theme_name
Do you think we want to be running the WordPress unit tests? Seems like this would take ages, and only uncover issues that we can't fix (since we can't edit WordPress core files).
I'm thinking that our testing should be focussed only on the code under our control (ie, the code inside our plugins)
My thinking was that the developer would have access to the wordpress test cases, so they could run, as an example, wp ajax tests within their own tests.
What do the wp ajax tests test?
On Saturday, April 13, 2013, daithi-coombes wrote:
My thinking was that the developer would have access to the wordpress test cases, so they could run, as an example, wp ajax tests within their own tests.
— Reply to this email directly or view it on GitHubhttps://github.com/mrdavidlaing/pressupbox-development-boilerplate/issues/22#issuecomment-16340353 .
David Laing Open source @ City Index - github.com/cityindex http://davidlaing.com Twitter: @davidlaing
Something like the process described here: http://wp-cli.org/blog/plugin-unit-tests.html