Exemplo n.º 1
0
 /**
  * Covers bu_navigation_page_parent_dropdown()
  */
 public function test_bu_navigation_page_parent_dropdown()
 {
     $parent = $this->posts['parent'];
     $child = $this->posts['child'];
     $test = $this->posts['test'];
     $post_types = 'page';
     $dropdown_expected = "<select id=\"bu_filter_pages\" name=\"post_parent\">\r" . "\n\t<option value=\"0\">Show all sections</option>\r" . "\n\t<option value=\"" . $parent . "\" >Parent Page</option>\r" . "\r</select>\r";
     ob_start();
     bu_navigation_page_parent_dropdown($post_types);
     $dropdown_results = ob_get_contents();
     ob_end_clean();
     $this->assertEquals($dropdown_expected, $dropdown_results);
     /**
      *	Test Post Type Function
      */
     $post_types_test = 'test';
     $dropdown_posttype_expected = "<select id=\"bu_filter_pages\" name=\"post_parent\">\r" . "\n\t<option value=\"" . $test . "\" >Test Type Page</option>\r" . "\r</select>\r";
     ob_start();
     bu_navigation_page_parent_dropdown($post_types_test);
     $dropdown_posttype_results = ob_get_contents();
     ob_end_clean();
     $this->assertEquals($dropdown_posttype_expected, $dropdown_posttype_expected);
     /**
      *	Test Selected Function
      */
     $selected = $parent;
     $dropdown_selected_expected = "<select id=\"bu_filter_pages\" name=\"post_parent\">\r" . "\n\t<option value=\"0\">Show all sections</option>\r" . "\n\t<option value=\"" . $parent . "\" selected=\"selected\">Parent Page</option>\r" . "\r</select>\r";
     ob_start();
     bu_navigation_page_parent_dropdown($post_types, $selected);
     $dropdown_selected_results = ob_get_contents();
     ob_end_clean();
     $this->assertEquals($dropdown_selected_expected, $dropdown_selected_results);
     /**
      *	Test Echo Function
      */
     $dropdown_echo_expected = "<select id=\"bu_filter_pages\" name=\"post_parent\">\r" . "\n\t<option value=\"0\">Show all sections</option>\r" . "\n\t<option value=\"" . $parent . "\" >Parent Page</option>\r" . "\r</select>\r";
     $args = array('echo' => 0);
     $dropdown_echo_results = bu_navigation_page_parent_dropdown($post_types, 0, $args);
     $this->assertEquals($dropdown_echo_expected, $dropdown_echo_results);
     /**
      *	Test Select ID Function
      */
     $dropdown_select_id_expected = "<select id=\"test_select_id\" name=\"post_parent\">\r" . "\n\t<option value=\"0\">Show all sections</option>\r" . "\n\t<option value=\"" . $parent . "\" >Parent Page</option>\r" . "\r</select>\r";
     $args = array('echo' => 0, 'select_id' => 'test_select_id');
     $dropdown_select_id_results = bu_navigation_page_parent_dropdown($post_types, 0, $args);
     $this->assertEquals($dropdown_select_id_expected, $dropdown_select_id_results);
     /**
      *	Test Select Name Function
      */
     $dropdown_select_name_expected = "<select id=\"bu_filter_pages\" name=\"test_name\">\r" . "\n\t<option value=\"0\">Show all sections</option>\r" . "\n\t<option value=\"" . $parent . "\" >Parent Page</option>\r" . "\r</select>\r";
     $args = array('echo' => 0, 'select_name' => 'test_name');
     $dropdown_select_name_results = bu_navigation_page_parent_dropdown($post_types, 0, $args);
     $this->assertEquals($dropdown_select_name_expected, $dropdown_select_name_results);
     /**
      *	Test Select Classes Function
      */
     $dropdown_classes_expected = "<select id=\"bu_filter_pages\" name=\"post_parent\" class=\"test_class\">\r" . "\n\t<option value=\"0\">Show all sections</option>\r" . "\n\t<option value=\"" . $parent . "\" >Parent Page</option>\r" . "\r</select>\r";
     $args = array('echo' => 0, 'select_classes' => 'test_class');
     $dropdown_classes_results = bu_navigation_page_parent_dropdown($post_types, 0, $args);
     $this->assertEquals($dropdown_classes_expected, $dropdown_classes_results);
 }
Exemplo n.º 2
0
 public function render_dropdown()
 {
     bu_navigation_page_parent_dropdown($this->post_type, $this->post_parent);
 }