function testManuallyAddedFields() { _insert_manually_added_fields(); $post_id = 11; // test single/first values $this->assertEquals("Text entered in the text field", simple_fields_value("field_text", $post_id)); $this->assertEquals("Text entered in the textarea", simple_fields_value("field_textarea", $post_id)); $this->assertEquals("<p>Text entered in the TinyMCE-editor.</p>\n", simple_fields_value("field_textarea_html", $post_id)); $this->assertEquals("1", simple_fields_value("field_checkbox", $post_id)); $this->assertEquals("radiobutton_num_4", simple_fields_value("field_radiobuttons", $post_id)); $this->assertEquals("dropdown_num_3", simple_fields_value("field_dropdown", $post_id)); $this->assertEquals(14, simple_fields_value("field_file", $post_id)); $this->assertEquals(11, simple_fields_value("field_post", $post_id)); $this->assertEquals("post_tag", simple_fields_value("field_taxonomy", $post_id)); $this->assertEquals(array(0 => 1), simple_fields_value("field_taxonomy_term", $post_id)); $this->assertEquals("FF3C26", simple_fields_value("field_color", $post_id)); $this->assertEquals("12/10/2012", simple_fields_value("field_date", $post_id)); $this->assertEquals(1, simple_fields_value("field_user", $post_id)); // test repeatable/all values #echo "xxx"; #var_dump( simple_fields_values("field_text") ); #exit; #print_r($allvals); $val = array(0 => "Text entered in the text field", 1 => "text in textfield 2<span>yes it is</span>"); $this->assertEquals($val, simple_fields_values("field_text", $post_id)); $val = array(0 => "Text entered in the textarea", 1 => "Textera with more funky text in it.\r\n\r\n<h2>Headline</h2>\r\n<ul>\r\n\t<li>Item 1</li>\r\n\t<li>Item 2</li>\r\n</ul>\r\n"); $get_vals = simple_fields_values("field_textarea", $post_id); $this->assertEquals($val, $get_vals); $val = array(0 => "<p>Text entered in the TinyMCE-editor.</p>\n", 1 => "<p>Tiny editors are great!</p>\n<p>You can style the content and insert images and stuff. Groovy! Funky!</p>\n<h2>A list</h2>\n<ul>\n<li>List item 1</li>\n<li>List item 2</li>\n</ul>\n<h2>And images can be inserted</h2>\n<p><a href=\"http://unit-test.simple-fields.com/wordpress/wp-content/uploads/2012/10/product-cat-2.jpeg\"><img class=\"alignnone wp-image-14\" title=\"product-cat-2\" src=\"http://unit-test.simple-fields.com/wordpress/wp-content/uploads/2012/10/product-cat-2.jpeg\" alt=\"\" width=\"368\" height=\"277\" /></a></p>\n"); $get_vals = simple_fields_values("field_textarea_html", $post_id); $this->assertEquals($val[1], $get_vals[1]); $val = array(0 => 1, 1 => ""); $this->assertEquals($val, simple_fields_values("field_checkbox", $post_id)); $val = array(0 => "radiobutton_num_4", 1 => "radiobutton_num_2"); $this->assertEquals($val, simple_fields_values("field_radiobuttons", $post_id)); $val = array(0 => "dropdown_num_3", 1 => "dropdown_num_2"); $this->assertEquals($val, simple_fields_values("field_dropdown", $post_id)); $val = array(0 => 14, 1 => 17); $this->assertEquals($val, simple_fields_values("field_file", $post_id)); $val = array(0 => 11, 1 => 5); $this->assertEquals($val, simple_fields_values("field_post", $post_id)); $val = array(0 => "post_tag", 1 => "category"); $this->assertEquals($val, simple_fields_values("field_taxonomy", $post_id)); $val = array(0 => array(0 => 1), 1 => ""); $this->assertEquals($val, simple_fields_values("field_taxonomy_term", $post_id)); $val = array(0 => "FF3C26", 1 => "8B33FF"); $this->assertEquals($val, simple_fields_values("field_color", $post_id)); $val = array(0 => "12/10/2012", 1 => "15/10/2012"); $this->assertEquals($val, simple_fields_values("field_date", $post_id)); $val = array(0 => "1", 1 => "1"); $this->assertEquals($val, simple_fields_values("field_user", $post_id)); // date & time picker 2 $val = array(0 => array("type" => "datetime", "date_unixtime" => "1359624600", "ISO_8601" => "2013-01-31 09:30", "RFC_2822" => "Thu, 31 Jan 2013 09:30:00 +0000", "Y-m-d" => "2013-01-31", "Y-m-d H:i" => "2013-01-31 09:30", "date_format" => "January 31, 2013", "date_time_format" => "January 31, 2013 9:30 am"), 1 => array("type" => "datetime", "date_unixtime" => "1355162400", "ISO_8601" => "2012-12-10 18:00", "RFC_2822" => "Mon, 10 Dec 2012 18:00:00 +0000", "Y-m-d" => "2012-12-10", "Y-m-d H:i" => "2012-12-10 18:00", "date_format" => "December 10, 2012", "date_time_format" => "December 10, 2012 6:00 pm")); $this->assertEquals($val, simple_fields_values("field_date_picker_2", $post_id)); }
function testInsertManuallyAddedFields() { _insert_manually_added_fields(); }