/** * * @group pdf-model */ public function test_valid_gravity_forms() { $this->AssertEquals(false, GFPDF_Core_Model::valid_gravity_forms()); /* * Test active form */ $_POST['gform_submit'] = $this->form_id[0]; $this->AssertEquals(true, GFPDF_Core_Model::valid_gravity_forms()); /* * Test inactive form */ $_POST['gform_submit'] = $this->form_id[1]; $this->AssertEquals(true, GFPDF_Core_Model::valid_gravity_forms()); /* * Test non-existant form */ $_POST['gform_submit'] = 5; $this->AssertEquals(false, GFPDF_Core_Model::valid_gravity_forms()); }
public function __construct() { /* * Ensure the system is fully installed * We run this after the 'settings' page has been set up (above) */ if (GFPDF_Core_Model::is_fully_installed() === false) { return; } global $gfpdfe_data; /* * Set up the PDF configuration and indexer * Accessed through $this->configuration and $this->index. */ parent::__construct(); /* * Add our main hooks */ add_action('gform_entries_first_column_actions', array('GFPDF_Core_Model', 'pdf_link'), 10, 4); add_action("gform_entry_info", array('GFPDF_Core_Model', 'detail_pdf_link'), 10, 2); add_action('wp', array('GFPDF_Core_Model', 'process_exterior_pages')); /* * Apply default filters */ add_filter('gfpdfe_pdf_template', array('PDF_Common', 'do_mergetags'), 10, 3); /* convert mergetags in PDF template automatically */ add_filter('gfpdfe_pdf_template', 'do_shortcode', 10, 1); /* convert shortcodes in PDF template automatically */ /* Check if on the entries page and output javascript */ if (is_admin() && rgget('page') == 'gf_entries') { wp_enqueue_script('gfpdfeentries', PDF_PLUGIN_URL . 'resources/javascript/entries-admin.min.js', array('jquery')); } /* * Register render class */ $this->render = new PDFRender(); /* * Run the notifications filter / save action hook if the web server can write to the output folder */ if ($gfpdfe_data->can_write_output_dir === true) { add_action('gform_after_submission', array('GFPDF_Core_Model', 'gfpdfe_save_pdf'), 10, 2); add_filter('gform_notification', array('GFPDF_Core_Model', 'gfpdfe_create_and_attach_pdf'), 100, 3); /* ensure it's called later than standard so the attachment array isn't overridden */ } }
/** * [test_fully_installed description] * @group core */ public function test_fully_installed() { $this->assertTrue(GFPDF_Core_Model::is_fully_installed()); }