bobbingwide / oik-batch

Batch interface to WordPress
https://www.oik-plugins.com/oik-plugins/oik-batch
GNU General Public License v2.0
0 stars 0 forks source link

oik-wp.php - remove dependencies on oik or oik-bwtrace #10

Closed bobbingwide closed 8 years ago

bobbingwide commented 8 years ago

Background waffle

When I first developed the oik-batch logic it only loaded a subset of WordPress and made a lot of use of functionality in oik.
Over time, for quite a few batch processes, I realised I needed a full WordPress installation. So, I developed oik-wp.php to do just that; a command line interface to load WordPress and then load (and run) your batch routine.

While oik-wp.php has had to solve similar problems to those encountered by WP-cli, my solution has taken a slightly different direction.

Recently, with WordPress 4.6 released, I decided it was time to implement PHPUnit testing of my plugins and themes.

I read a number of blogs and looked at existing test suites and decided that I actually wanted to be able to write unit tests that can be run in situ.

So in #9, I prototyped a solution which I believe can be used by WordPress plugins and themes alike. Theoretically all you need is:

  1. PHPUnit in order to run your tests
  2. oik-wp.php to load an existing WordPress environment
  3. functionality extracted from the tests subdirectory of the core development repository (e.g. https://github.com/bobbingwide/wordpress-develop-tests )
  4. your plugin's or theme's tests

The trouble is, I think that oik-wp is dependent on functionality in oik and/or oik-bwtrace. So it's not yet ready for general release.

Requirement

Remove dependency on oik and/or oik-bwtrace so that oik-wp.php can be used in PHPUnit testing of WordPress plugins and themes in situ.

Proposed solution

Use the same solution developed in oik-bwtrace to make oik-wp.php operate stand alone. i.e. Deliver the required shared library files as part of oik-batch. Note: oik-batch already delivers some shared libraries,so this shouldn't be too problematical.

While we're at it

Some of the main routines delivered in oik-batch are totally dependent on oik and other oik plugins. Over time these routines should be migrated to the most appropriate plugin.