O'Reilly logo

WordPress 3 Plugin Development Essentials by Everett Griffiths, Brian Bondari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Modifying loader.php

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required