/** * Test our notification function * @group pdf * @group pdf-model */ public function test_gfpdfe_create_and_attach_pdf() { global $gfpdf; $gfpdf->render = new PDFRender(); $form = GFAPI::get_form($this->form_id[0]); $entry = GFAPI::get_entry($this->entries[0]); $notification = array('name' => 'Admin Notification', 'attachments' => array()); /* * Run first test */ $test1 = GFPDF_Core_Model::gfpdfe_create_and_attach_pdf($notification, $form, $entry); $this->AssertEquals(3, sizeof($test1['attachments'])); /* * Run second test */ $notification['name'] = 'User Notification'; $test2 = GFPDF_Core_Model::gfpdfe_create_and_attach_pdf($notification, $form, $entry); $this->AssertEquals(4, sizeof($test2['attachments'])); /* * Run third test */ $form['notifications']['5414ff2b70019'] = array('name' => 'Bunny Notification', 'event' => 'form_submission'); $notification['name'] = 'Bunny Notification'; $test3 = GFPDF_Core_Model::gfpdfe_create_and_attach_pdf($notification, $form, $entry); $this->AssertEquals(1, sizeof($test3['attachments'])); /* * Run fourth test */ $notification['name'] = 'Bugs Bunny Notification'; $test3 = GFPDF_Core_Model::gfpdfe_create_and_attach_pdf($notification, $form, $entry); $this->AssertEquals(0, sizeof($test3['attachments'])); }