function test_create_form() { FrmAppController::install(); $frm_form = new FrmForm(); $values = FrmFormsHelper::setup_new_vars(false); $id = $frm_form->create($values); $this->assertGreaterThan(0, $id); }
/** * @covers FrmAppController::install() */ function frm_install() { if (!defined('WP_IMPORTING')) { // set this to false so all our tests won't be done with this active define('WP_IMPORTING', false); } FrmHooksController::trigger_load_hook('load_admin_hooks'); FrmAppController::install(); $this->do_tables_exist(); $this->import_xml(); }
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'); } }
/** * @covers FrmDb::migrate_to_17 */ function test_migrate_from_12_to_17() { $this->frm_install(); update_option('frm_db_version', 12); $form = FrmForm::getOne('contact-db12'); $this->assertNotEmpty($form); $this->assertTrue(is_numeric($form->id)); $notification = array(0 => array('email_to' => '*****@*****.**', 'also_email_to' => array(1, 2), 'reply_to' => '*****@*****.**', 'reply_to_name' => 'Reply to me', 'cust_reply_to' => '', 'cust_reply_to_name' => '', 'plain_text' => 1, 'email_message' => 'This is my email message. [default-message]', 'email_subject' => 'The subject', 'update_email' => 2, 'inc_user_info' => 1)); $form->options['notification'] = $notification; global $wpdb; $updated = $wpdb->update($wpdb->prefix . 'frm_forms', array('options' => maybe_serialize($form->options)), array('id' => $form->id)); FrmForm::clear_form_cache(); $this->assertEquals($updated, 1); $form = FrmForm::getOne('contact-db12'); $this->assertNotEmpty($form->options, 'The form settings are empty'); $this->assertTrue(isset($form->options['notification']), 'The old notification settings are missing'); $this->assertEquals($form->options['notification'][0]['email_to'], '*****@*****.**'); // migrate data FrmAppController::install(); $form_actions = FrmFormAction::get_action_for_form($form->id, 'email'); foreach ($form_actions as $action) { $this->assertTrue(strpos($action->post_content['email_to'], '*****@*****.**') !== false); } }