Example #1
0
 function test_function_and_shortcode_is_equal()
 {
     $utcw = UTCW_Plugin::getInstance();
     $shortCode = new UTCW_ShortCode($utcw);
     $this->expectOutputString($shortCode->render(array()));
     do_utcw(array());
 }
Example #2
0
 function test_runs_shortcode_pre_action_when_post_has_shortcode()
 {
     global $post;
     global $called;
     $called = false;
     add_action('utcw_pre_shortcode', create_function('', 'global $called; $called = true;'));
     if (!$post) {
         $post = new stdClass();
     }
     $post->post_content = 'Hello World';
     $this->shortCode->triggerPreShortCode();
     $this->assertFalse($called, 'Pre short code should not be called when short code is not present');
     $post->post_content = 'test 123 [utcw title="wtf dude"] 123 test';
     $this->shortCode->triggerPreShortCode();
     $this->assertTrue($called, 'Pre short code should be called when short code is present');
 }
/**
 * Function for theme integration
 *
 * @param array $args
 *
 * @since 1.3
 */
function do_utcw(array $args)
{
    $plugin = UTCW_Plugin::getInstance();
    $shortCode = new UTCW_ShortCode($plugin);
    echo $shortCode->render($args);
}