March 2011
Beginner to intermediate
300 pages
7h 23m
English
We have set this up to use a dedicated class containing all the tests we need our plugin to run:
<?php
// loader.php
// Required Files
include_once('includes/MyPlugin.php');
include_once('tests/MyPlugin_tests.php');
// Run Tests.
MyPlugin_tests::test1();
MyPlugin_tests::test2();
// ... more tests go here ...
// If there were no errors, load our plugin normally
if ( empty(MyPlugin_tests::$errors) )
{
add_action( 'init', 'MyPlugin::do_stuff');
// ... other actions here ...
}
// There were errors!
else
{
add_action( 'admin_notices', ' MyPlugin_tests::print_notices');
}
/*EOF*/Can you see how we're setting this up? In addition to including our standard includes for our plugin, now we're going to also include a special class that ...
Read now
Unlock full access