/**
  * @covers GravityView_Entry_Link_Shortcode::edit_shortcode
  */
 function _test_edit($view, $entry, $atts)
 {
     $nonce_key = GravityView_Edit_Entry::get_nonce_key($view->ID, $entry['form_id'], $entry['id']);
     $nonce = wp_create_nonce($nonce_key);
     $gvid = GravityView_View_Data::getInstance()->has_multiple_views() ? '&gvid=' . gravityview_get_view_id() : '';
     $atts['return'] = 'html';
     $edit_link = $this->object->edit_shortcode($atts);
     $atts['action'] = 'edit';
     $edit_link_backward_compat = $this->object->read_shortcode($atts);
     $this->assertEquals($edit_link, $edit_link_backward_compat);
     $this->assertEquals('<a href="http://example.org/?p=' . $atts['post_id'] . '&amp;entry=' . $atts['entry_id'] . esc_attr($gvid) . '&amp;page=gf_entries&amp;view=entry&amp;edit=' . $nonce . '">Edit Entry</a>', $edit_link, 'edit link');
     $atts['return'] = 'url';
     $edit_link_return_url = $this->object->edit_shortcode($atts);
     $this->assertEquals('http://example.org/?p=' . $atts['post_id'] . '&entry=' . $atts['entry_id'] . $gvid . '&page=gf_entries&view=entry&edit=' . $nonce, $edit_link_return_url, 'edit link URL only');
     $atts['return'] = 'html';
     $atts['link_atts'] = 'target="_blank"&title="check me out!"';
     $edit_link_link_atts = $this->object->edit_shortcode($atts);
     $this->assertEquals('<a title="&quot;check me out!&quot;" target="&quot;_blank&quot;" href="http://example.org/?p=' . $atts['post_id'] . '&amp;entry=' . $atts['entry_id'] . esc_attr($gvid) . '&amp;page=gf_entries&amp;view=entry&amp;edit=' . $nonce . '">Edit Entry</a>', $edit_link_link_atts, 'edit link, return html, with link_atts target="_blank"&title="check me out!"');
     $atts['return'] = 'html';
     $atts['link_atts'] = 'target=_blank&title=check me out!';
     $edit_link_link_atts = $this->object->edit_shortcode($atts);
     $this->assertEquals('<a title="check me out!" target="_blank" href="http://example.org/?p=' . $atts['post_id'] . '&amp;entry=' . $atts['entry_id'] . esc_attr($gvid) . '&amp;page=gf_entries&amp;view=entry&amp;edit=' . $nonce . '">Edit Entry</a>', $edit_link_link_atts, 'edit link return html with link atts target=_blank&title=check me out!');
     $zero = $this->factory->user->create_and_set(array('role' => 'zero'));
     // User without edit entry caps should not be able to see link
     $this->assertNull($this->object->edit_shortcode($atts), 'user with no caps shouldn\'t be able to see link');
 }
 /**
  * When Edit entry view is requested setup the vars
  */
 function setup_vars()
 {
     $gravityview_view = GravityView_View::getInstance();
     $entries = $gravityview_view->getEntries();
     $this->entry = $entries[0];
     //custom MF code to allow multiple forms in a view
     $this->form_id = $this->entry['form_id'];
     $this->form = GFAPI::get_form($this->form_id);
     //$this->form = $gravityview_view->getForm();
     //$this->form_id = $gravityview_view->getFormId();
     $this->view_id = $gravityview_view->getViewId();
     self::$nonce_key = GravityView_Edit_Entry::get_nonce_key($this->view_id, $this->form_id, $this->entry['id']);
 }
 /**
  * When Edit entry view is requested setup the vars
  */
 function setup_vars()
 {
     $gravityview_view = GravityView_View::getInstance();
     $entries = $gravityview_view->getEntries();
     $this->entry = $entries[0];
     $this->form = $gravityview_view->getForm();
     $this->form_id = $gravityview_view->getFormId();
     $this->view_id = $gravityview_view->getViewId();
     self::$nonce_key = GravityView_Edit_Entry::get_nonce_key($this->view_id, $this->form_id, $this->entry['id']);
 }
 /**
  * @covers GravityView_Edit_Entry::get_nonce_key()
  */
 public function test_get_nonce_key()
 {
     $view_id = 1;
     $form_id = 2;
     $entry_id = 3;
     $nonce_key = GravityView_Edit_Entry::get_nonce_key($view_id, $form_id, $entry_id);
     $this->assertEquals($nonce_key, sprintf('edit_%d_%d_%d', $view_id, $form_id, $entry_id));
 }