Lines:
1 to 63 of 63
<?php // (C) Copyright Bobbing Wide 2016 /** * PHPUnit bootstrap for oik-batch * For running WordPress plugin and/or theme unit tests under PHPUnit. * Normally, the bootstrap file is invoked by phpunit, * loading phpunit.xml in preference to phpunit.xml.dist, * and finding the bootstrap parameter in the main tag * `<phpunit bootstrap="tests/bootstrap.php" backupGlobals="false" colors="true">` * * With oik-batch the bootstrap is different. * Instead of loading tests/bootstrap.php we load ../oik-batch/oik-wp.php * using `phpunit --bootstrap=../oik-batch/oik-wp.php` * or `<phpunit bootstrap="../oik-batch/oik-wp.php" >` * * oik-wp will instantiate WordPress, with all the active plugins and themes, * and without resetting the database. * * * The bootstrap file for wordpress-develop-tests does a lot of things including resetting the database. * But most importantly it loads the PHP classes that we need to develop our tests ( WP_UnitTestCase ) * * We would like to try running tests on any database without destroying the original contents. * In this code we're trying to answer the questions... * * - Is this possible? * - How easy is this to do? * - What problems does this introduce with regards to using existing test data? * - i.e. Is this a silly thing to do? * - Can we run phpunit under WordPress or must phpunit be in charge? * * @TODO Rather than resetting the database to a defined checkpoint ( original idea August 2016 ) * we need to ensure that WP_UnitTestCase does not do anything silly with the database. * We do this by implementing our own instance of WP_UnitTestCase. * * */ bootstrap_loaded(); /* function bootstrap_loaded() – Function to invoke when loaded */ /* function _manually_load_plugin() – Self load the plugin’s main .php file */ /* function locate_wordpress_develop_tests() – Locate the wordpress-develop-tests code */ /* function locate_oik_batch() – Locate oik-batch */ /* function continue_loading_bootstrap() – Load the WordPress develop tests bootstrap.php file */ /* function load_bootstrap_functions() – Load the WordPress develop tests functions.php file or our oik-batch replacements for in situ */ /* function locate_wordpress_develop_tests_plugin() – Locate the wordpress-develop-tests plugin */ /* function check_wordpress_develop_tests_version() – Check WordPress develop tests are compatible with WordPress installation */View on GitHub