function test_trigger_load_form_hooks()
 {
     FrmHooksController::trigger_load_form_hooks();
     $expected_hooks = array('frm_field_type' => 'FrmFieldsController::change_type', 'frm_field_input_html' => 'FrmFieldsController::input_html', 'frm_field_value_saved' => 'FrmFieldsController::check_value');
     foreach ($expected_hooks as $tag => $function) {
         $has_filter = has_filter($tag, $function);
         $this->assertTrue($has_filter !== false, 'The ' . $tag . ' hook is not loaded');
     }
 }
Ejemplo n.º 2
0
    if (preg_match('/^FrmPro.+$/', $class_name) || 'FrmUpdatesController' == $class_name) {
        $filepath .= '/pro';
    }
    $filepath .= '/classes';
    if (preg_match('/^.+Helper$/', $class_name)) {
        $filepath .= '/helpers/';
    } else {
        if (preg_match('/^.+Controller$/', $class_name)) {
            $filepath .= '/controllers/';
        } else {
            $filepath .= '/models/';
        }
    }
    $filepath .= $class_name . '.php';
    if (file_exists($filepath)) {
        include $filepath;
    }
}
// if __autoload is active, put it on the spl_autoload stack
if (is_array(spl_autoload_functions()) && in_array('__autoload', spl_autoload_functions())) {
    spl_autoload_register('__autoload');
}
// Add the autoloader
spl_autoload_register('frm_forms_autoloader');
$frm_path = dirname(__FILE__);
if (file_exists($frm_path . '/pro/formidable-pro.php')) {
    include $frm_path . '/pro/formidable-pro.php';
}
FrmHooksController::trigger_load_hook();
include_once $frm_path . '/deprecated.php';
unset($frm_path);
Ejemplo n.º 3
0
 function set_admin_screen($page = 'index.php')
 {
     global $current_screen;
     $screens = array('index.php' => array('base' => 'dashboard', 'id' => 'dashboard'), 'admin.php?page=formidable' => array('base' => 'admin', 'id' => 'toplevel_page_formidable'));
     if ($page == 'formidable-edit') {
         $form = $this->factory->form->get_object_by_id($this->contact_form_key);
         $page = 'admin.php?page=formidable&frm_action=edit&id=' . $form->id;
         $screens[$page] = $screens['admin.php?page=formidable'];
     }
     $screen = $screens[$page];
     $_GET = $_POST = $_REQUEST = array();
     $GLOBALS['taxnow'] = $GLOBALS['typenow'] = '';
     $screen = (object) $screen;
     $hook = parse_url($page);
     $GLOBALS['hook_suffix'] = $hook['path'];
     set_current_screen();
     $this->assertTrue($current_screen->in_admin(), 'Failed to switch to the back-end');
     $this->assertEquals($screen->base, $current_screen->base, $page);
     FrmHooksController::trigger_load_hook();
 }
<?php

FrmHooksController::trigger_load_hook('load_admin_hooks');
FrmHooksController::trigger_load_hook('load_ajax_hooks');
FrmHooksController::trigger_load_hook('load_form_hooks');
/**
 * @group ajax
 */
class FrmAjaxUnitTest extends WP_Ajax_UnitTestCase
{
    protected $form_id = 0;
    protected $field_id = 0;
    protected $user_id = 0;
    protected $is_pro_active = false;
    protected $contact_form_key = 'contact-with-email';
    function setUp()
    {
        parent::setUp();
        FrmAppController::install();
        $this->import_xml();
        $this->factory->form = new Form_Factory($this);
        $this->factory->field = new Field_Factory($this);
        $this->factory->entry = new Entry_Factory($this);
        $this->is_pro_active = FrmAppHelper::pro_is_installed();
        $current_class_name = get_class($this);
        if (strpos($current_class_name, 'FrmPro') && !$this->is_pro_active) {
            $this->markTestSkipped('Pro is not active');
        }
    }
    function import_xml()
    {
 public static function trigger_load_view_hooks()
 {
     FrmHooksController::trigger_load_hook('load_view_hooks');
 }