示例#1
0
function _wpr_add_autoresponder_post_handler()
{
    global $wpdb;
    if (!wp_verify_nonce($_POST['_wpr_add_autoresponder'], '_wpr_add_autoresponder')) {
        return;
    }
    AutorespondersController::add_post_handler();
}
 public function testWhetherAutoresponderIsAdded()
 {
     $_POST['nid'] = 1;
     $responderName = 'Test Autoresponder 5432';
     $_POST['autoresponder_name'] = $responderName;
     try {
         AutorespondersController::add_post_handler();
     } catch (Exception $e) {
         //until the day I figure out what to do with that wp_redirect call failing every test...
     }
     $autoresponders = Autoresponder::getAllAutoresponders();
     $found = false;
     foreach ($autoresponders as $responder) {
         $name = $responder->getName();
         if ($name == $responderName) {
             $found = true;
         }
     }
     $this->assertEquals(true, $found);
 }