Inheritance: extends PHPUnit_Framework_TestCase
 public function testAuthToken()
 {
     parent::authTokenTest();
 }
 public function setUp()
 {
     $testTicket = array('id' => '12345', 'subject' => 'The quick brown fox jumps over the lazy dog', 'comment' => array('body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'), 'priority' => 'normal');
     $this->ticket_id = $testTicket['id'];
     parent::setUp();
 }
    function insertDataForManualAddedFields()
    {
        global $wpdb;
        // Create post that has manually added simple fields
        // First we create the post, then we add the custom fields
        // post_name=post-with-fields
        // post_content=I am a post with fields attached.
        // post_title=Post with fields
        $post_id = $this->factory->post->create(array("post_title" => "Post with fields"));
        self::$post_id_for_manual_tests = $post_id;
        // Insert options for Simple Fields
        // Nothing here is for specific posts
        $query = <<<EOT
\t\t\tINSERT INTO `{$wpdb->options}` (`option_name`, `option_value`, `autoload`)
\t\t\tVALUES ('simple_fields_options', 'a:4:{i:0;b:0;s:10:\\"debug_type\\";i:1;s:23:\\"phpunittest_save_option\\";s:15:\\"new saved value\\";s:31:\\"phpunittest_save_another_option\\";s:13:\\"another value\\";}', 'yes')
EOT;
        $wpdb->query($query);
        $query = <<<EOT
\t\t\tINSERT INTO `{$wpdb->options}` (`option_name`, `option_value`, `autoload`)
\t\t\tVALUES 
\t\t\t\t('simple_fields_groups', 'a:3:{i:1;a:9:{s:2:\\"id\\";i:1;s:3:\\"key\\";s:20:\\"field_group_manually\\";s:4:\\"slug\\";s:20:\\"field_group_manually\\";s:4:\\"name\\";s:26:\\"Manually added field group\\";s:11:\\"description\\";s:50:\\"A group that is added manually from within the GUI\\";s:10:\\"repeatable\\";b:1;s:6:\\"fields\\";a:14:{i:1;a:11:{s:4:\\"name\\";s:10:\\"Text field\\";s:11:\\"description\\";s:12:\\"A text field\\";s:4:\\"slug\\";s:10:\\"field_text\\";s:4:\\"type\\";s:4:\\"text\\";s:7:\\"options\\";a:2:{s:7:\\"divider\\";a:1:{s:10:\\"appearance\\";s:4:\\"line\\";}s:7:\\"date_v2\\";a:3:{s:7:\\"show_as\\";s:4:\\"date\\";s:4:\\"show\\";s:6:\\"always\\";s:12:\\"default_date\\";s:7:\\"no_date\\";}}s:21:\\"type_textarea_options\\";a:1:{s:11:\\"size_height\\";s:7:\\"default\\";}s:17:\\"type_post_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:21:\\"type_dropdown_options\\";a:1:{s:15:\\"enable_multiple\\";s:1:\\"0\\";}s:2:\\"id\\";s:1:\\"1\\";s:7:\\"deleted\\";s:1:\\"0\\";}i:2;a:11:{s:4:\\"name\\";s:14:\\"Field textarea\\";s:11:\\"description\\";s:16:\\"A texteara field\\";s:4:\\"slug\\";s:14:\\"field_textarea\\";s:4:\\"type\\";s:8:\\"textarea\\";s:7:\\"options\\";a:2:{s:7:\\"divider\\";a:1:{s:10:\\"appearance\\";s:4:\\"line\\";}s:7:\\"date_v2\\";a:3:{s:7:\\"show_as\\";s:4:\\"date\\";s:4:\\"show\\";s:6:\\"always\\";s:12:\\"default_date\\";s:7:\\"no_date\\";}}s:21:\\"type_textarea_options\\";a:1:{s:11:\\"size_height\\";s:7:\\"default\\";}s:17:\\"type_post_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:21:\\"type_dropdown_options\\";a:1:{s:15:\\"enable_multiple\\";s:1:\\"0\\";}s:2:\\"id\\";s:1:\\"2\\";s:7:\\"deleted\\";s:1:\\"0\\";}i:3;a:11:{s:4:\\"name\\";s:19:\\"Field textarea HTML\\";s:11:\\"description\\";s:41:\\"A textarea field with HTML-editor enabled\\";s:4:\\"slug\\";s:19:\\"field_textarea_html\\";s:4:\\"type\\";s:8:\\"textarea\\";s:7:\\"options\\";a:2:{s:7:\\"divider\\";a:1:{s:10:\\"appearance\\";s:4:\\"line\\";}s:7:\\"date_v2\\";a:3:{s:7:\\"show_as\\";s:4:\\"date\\";s:4:\\"show\\";s:6:\\"always\\";s:12:\\"default_date\\";s:7:\\"no_date\\";}}s:21:\\"type_textarea_options\\";a:2:{s:11:\\"size_height\\";s:7:\\"default\\";s:15:\\"use_html_editor\\";s:1:\\"1\\";}s:17:\\"type_post_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:21:\\"type_dropdown_options\\";a:1:{s:15:\\"enable_multiple\\";s:1:\\"0\\";}s:2:\\"id\\";s:1:\\"3\\";s:7:\\"deleted\\";s:1:\\"0\\";}i:4;a:11:{s:4:\\"name\\";s:14:\\"FIeld checkbox\\";s:11:\\"description\\";s:16:\\"A checkbox field\\";s:4:\\"slug\\";s:14:\\"field_checkbox\\";s:4:\\"type\\";s:8:\\"checkbox\\";s:7:\\"options\\";a:2:{s:7:\\"divider\\";a:1:{s:10:\\"appearance\\";s:4:\\"line\\";}s:7:\\"date_v2\\";a:3:{s:7:\\"show_as\\";s:4:\\"date\\";s:4:\\"show\\";s:6:\\"always\\";s:12:\\"default_date\\";s:7:\\"no_date\\";}}s:21:\\"type_textarea_options\\";a:1:{s:11:\\"size_height\\";s:7:\\"default\\";}s:17:\\"type_post_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:21:\\"type_dropdown_options\\";a:1:{s:15:\\"enable_multiple\\";s:1:\\"0\\";}s:2:\\"id\\";s:1:\\"4\\";s:7:\\"deleted\\";s:1:\\"0\\";}i:5;a:12:{s:4:\\"name\\";s:19:\\"Field radioibuttons\\";s:11:\\"description\\";s:20:\\"A radiobuttons field\\";s:4:\\"slug\\";s:18:\\"field_radiobuttons\\";s:4:\\"type\\";s:12:\\"radiobuttons\\";s:7:\\"options\\";a:2:{s:7:\\"divider\\";a:1:{s:10:\\"appearance\\";s:4:\\"line\\";}s:7:\\"date_v2\\";a:3:{s:7:\\"show_as\\";s:4:\\"date\\";s:4:\\"show\\";s:6:\\"always\\";s:12:\\"default_date\\";s:7:\\"no_date\\";}}s:21:\\"type_textarea_options\\";a:1:{s:11:\\"size_height\\";s:7:\\"default\\";}s:17:\\"type_post_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_radiobuttons_options\\";a:4:{s:17:\\"radiobutton_num_2\\";a:2:{s:5:\\"value\\";s:13:\\"Radiobutton 1\\";s:7:\\"deleted\\";s:1:\\"0\\";}s:17:\\"radiobutton_num_3\\";a:2:{s:5:\\"value\\";s:13:\\"Radiobutton 2\\";s:7:\\"deleted\\";s:1:\\"0\\";}s:22:\\"checked_by_default_num\\";s:17:\\"radiobutton_num_3\\";s:17:\\"radiobutton_num_4\\";a:2:{s:5:\\"value\\";s:13:\\"Radiobutton 3\\";s:7:\\"deleted\\";s:1:\\"0\\";}}s:21:\\"type_dropdown_options\\";a:1:{s:15:\\"enable_multiple\\";s:1:\\"0\\";}s:2:\\"id\\";s:1:\\"5\\";s:7:\\"deleted\\";s:1:\\"0\\";}i:6;a:11:{s:4:\\"name\\";s:14:\\"Field dropdown\\";s:11:\\"description\\";s:16:\\"A dropdown field\\";s:4:\\"slug\\";s:14:\\"field_dropdown\\";s:4:\\"type\\";s:8:\\"dropdown\\";s:7:\\"options\\";a:2:{s:7:\\"divider\\";a:1:{s:10:\\"appearance\\";s:4:\\"line\\";}s:7:\\"date_v2\\";a:3:{s:7:\\"show_as\\";s:4:\\"date\\";s:4:\\"show\\";s:6:\\"always\\";s:12:\\"default_date\\";s:7:\\"no_date\\";}}s:21:\\"type_textarea_options\\";a:1:{s:11:\\"size_height\\";s:7:\\"default\\";}s:17:\\"type_post_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:21:\\"type_dropdown_options\\";a:4:{s:15:\\"enable_multiple\\";s:1:\\"0\\";s:14:\\"dropdown_num_2\\";a:2:{s:5:\\"value\\";s:10:\\"Dropdown 1\\";s:7:\\"deleted\\";s:1:\\"0\\";}s:14:\\"dropdown_num_3\\";a:2:{s:5:\\"value\\";s:10:\\"Dropdown 2\\";s:7:\\"deleted\\";s:1:\\"0\\";}s:14:\\"dropdown_num_4\\";a:2:{s:5:\\"value\\";s:10:\\"Dropdown 3\\";s:7:\\"deleted\\";s:1:\\"0\\";}}s:2:\\"id\\";s:1:\\"6\\";s:7:\\"deleted\\";s:1:\\"0\\";}i:7;a:11:{s:4:\\"name\\";s:10:\\"Field file\\";s:11:\\"description\\";s:12:\\"A file field\\";s:4:\\"slug\\";s:10:\\"field_file\\";s:4:\\"type\\";s:4:\\"file\\";s:7:\\"options\\";a:2:{s:7:\\"divider\\";a:1:{s:10:\\"appearance\\";s:4:\\"line\\";}s:7:\\"date_v2\\";a:3:{s:7:\\"show_as\\";s:4:\\"date\\";s:4:\\"show\\";s:6:\\"always\\";s:12:\\"default_date\\";s:7:\\"no_date\\";}}s:21:\\"type_textarea_options\\";a:1:{s:11:\\"size_height\\";s:7:\\"default\\";}s:17:\\"type_post_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:21:\\"type_dropdown_options\\";a:1:{s:15:\\"enable_multiple\\";s:1:\\"0\\";}s:2:\\"id\\";s:1:\\"7\\";s:7:\\"deleted\\";s:1:\\"0\\";}i:8;a:11:{s:4:\\"name\\";s:10:\\"Field post\\";s:11:\\"description\\";s:12:\\"A post field\\";s:4:\\"slug\\";s:10:\\"field_post\\";s:4:\\"type\\";s:4:\\"post\\";s:7:\\"options\\";a:2:{s:7:\\"divider\\";a:1:{s:10:\\"appearance\\";s:4:\\"line\\";}s:7:\\"date_v2\\";a:3:{s:7:\\"show_as\\";s:4:\\"date\\";s:4:\\"show\\";s:6:\\"always\\";s:12:\\"default_date\\";s:7:\\"no_date\\";}}s:21:\\"type_textarea_options\\";a:1:{s:11:\\"size_height\\";s:7:\\"default\\";}s:17:\\"type_post_options\\";a:2:{s:18:\\"enabled_post_types\\";a:2:{i:0;s:4:\\"post\\";i:1;s:4:\\"page\\";}s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:21:\\"type_dropdown_options\\";a:1:{s:15:\\"enable_multiple\\";s:1:\\"0\\";}s:2:\\"id\\";s:1:\\"8\\";s:7:\\"deleted\\";s:1:\\"0\\";}i:9;a:12:{s:4:\\"name\\";s:14:\\"Field taxonomy\\";s:11:\\"description\\";s:16:\\"A taxonomy field\\";s:4:\\"slug\\";s:14:\\"field_taxonomy\\";s:4:\\"type\\";s:8:\\"taxonomy\\";s:7:\\"options\\";a:2:{s:7:\\"divider\\";a:1:{s:10:\\"appearance\\";s:4:\\"line\\";}s:7:\\"date_v2\\";a:3:{s:7:\\"show_as\\";s:4:\\"date\\";s:4:\\"show\\";s:6:\\"always\\";s:12:\\"default_date\\";s:7:\\"no_date\\";}}s:21:\\"type_textarea_options\\";a:1:{s:11:\\"size_height\\";s:7:\\"default\\";}s:17:\\"type_post_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:21:\\"type_taxonomy_options\\";a:1:{s:18:\\"enabled_taxonomies\\";a:2:{i:0;s:8:\\"category\\";i:1;s:8:\\"post_tag\\";}}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:21:\\"type_dropdown_options\\";a:1:{s:15:\\"enable_multiple\\";s:1:\\"0\\";}s:2:\\"id\\";s:1:\\"9\\";s:7:\\"deleted\\";s:1:\\"0\\";}i:10;a:11:{s:4:\\"name\\";s:19:\\"Field Taxonomy Term\\";s:11:\\"description\\";s:21:\\"A taxonomy term field\\";s:4:\\"slug\\";s:19:\\"field_taxonomy_term\\";s:4:\\"type\\";s:12:\\"taxonomyterm\\";s:7:\\"options\\";a:2:{s:7:\\"divider\\";a:1:{s:10:\\"appearance\\";s:4:\\"line\\";}s:7:\\"date_v2\\";a:3:{s:7:\\"show_as\\";s:4:\\"date\\";s:4:\\"show\\";s:6:\\"always\\";s:12:\\"default_date\\";s:7:\\"no_date\\";}}s:21:\\"type_textarea_options\\";a:1:{s:11:\\"size_height\\";s:7:\\"default\\";}s:17:\\"type_post_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:2:{s:16:\\"enabled_taxonomy\\";s:8:\\"category\\";s:20:\\"additional_arguments\\";s:0:\\"\\";}s:21:\\"type_dropdown_options\\";a:1:{s:15:\\"enable_multiple\\";s:1:\\"0\\";}s:2:\\"id\\";s:2:\\"10\\";s:7:\\"deleted\\";s:1:\\"0\\";}i:11;a:11:{s:4:\\"name\\";s:11:\\"Field Color\\";s:11:\\"description\\";s:13:\\"A color field\\";s:4:\\"slug\\";s:11:\\"field_color\\";s:4:\\"type\\";s:5:\\"color\\";s:7:\\"options\\";a:2:{s:7:\\"divider\\";a:1:{s:10:\\"appearance\\";s:4:\\"line\\";}s:7:\\"date_v2\\";a:3:{s:7:\\"show_as\\";s:4:\\"date\\";s:4:\\"show\\";s:6:\\"always\\";s:12:\\"default_date\\";s:7:\\"no_date\\";}}s:21:\\"type_textarea_options\\";a:1:{s:11:\\"size_height\\";s:7:\\"default\\";}s:17:\\"type_post_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:21:\\"type_dropdown_options\\";a:1:{s:15:\\"enable_multiple\\";s:1:\\"0\\";}s:2:\\"id\\";%%THING1%%;s:7:\\"deleted\\";s:1:\\"0\\";}i:12;a:11:{s:4:\\"name\\";s:10:\\"Field Date\\";s:11:\\"description\\";s:12:\\"A date field\\";s:4:\\"slug\\";s:10:\\"field_date\\";s:4:\\"type\\";s:4:\\"date\\";s:7:\\"options\\";a:2:{s:7:\\"divider\\";a:1:{s:10:\\"appearance\\";s:4:\\"line\\";}s:7:\\"date_v2\\";a:3:{s:7:\\"show_as\\";s:4:\\"date\\";s:4:\\"show\\";s:6:\\"always\\";s:12:\\"default_date\\";s:7:\\"no_date\\";}}s:21:\\"type_textarea_options\\";a:1:{s:11:\\"size_height\\";s:7:\\"default\\";}s:17:\\"type_post_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:21:\\"type_dropdown_options\\";a:1:{s:15:\\"enable_multiple\\";s:1:\\"0\\";}s:2:\\"id\\";s:2:\\"12\\";s:7:\\"deleted\\";s:1:\\"0\\";}i:13;a:11:{s:4:\\"name\\";s:10:\\"Field user\\";s:11:\\"description\\";s:12:\\"A user field\\";s:4:\\"slug\\";s:10:\\"field_user\\";s:4:\\"type\\";s:4:\\"user\\";s:7:\\"options\\";a:2:{s:7:\\"divider\\";a:1:{s:10:\\"appearance\\";s:4:\\"line\\";}s:7:\\"date_v2\\";a:3:{s:7:\\"show_as\\";s:4:\\"date\\";s:4:\\"show\\";s:6:\\"always\\";s:12:\\"default_date\\";s:7:\\"no_date\\";}}s:21:\\"type_textarea_options\\";a:1:{s:11:\\"size_height\\";s:7:\\"default\\";}s:17:\\"type_post_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:21:\\"type_dropdown_options\\";a:1:{s:15:\\"enable_multiple\\";s:1:\\"0\\";}s:2:\\"id\\";s:2:\\"13\\";s:7:\\"deleted\\";s:1:\\"0\\";}i:14;a:11:{s:4:\\"name\\";s:19:\\"Field date picker 2\\";s:11:\\"description\\";s:21:\\"A date picker 2 field\\";s:4:\\"slug\\";s:19:\\"field_date_picker_2\\";s:4:\\"type\\";s:7:\\"date_v2\\";s:7:\\"options\\";a:2:{s:7:\\"divider\\";a:1:{s:10:\\"appearance\\";s:4:\\"line\\";}s:7:\\"date_v2\\";a:3:{s:7:\\"show_as\\";s:8:\\"datetime\\";s:4:\\"show\\";s:6:\\"always\\";s:12:\\"default_date\\";s:7:\\"no_date\\";}}s:21:\\"type_textarea_options\\";a:1:{s:11:\\"size_height\\";s:7:\\"default\\";}s:17:\\"type_post_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:21:\\"type_dropdown_options\\";a:1:{s:15:\\"enable_multiple\\";s:1:\\"0\\";}s:2:\\"id\\";s:2:\\"14\\";s:7:\\"deleted\\";s:1:\\"0\\";}}s:7:\\"deleted\\";b:0;s:12:\\"fields_count\\";i:13;}i:2;a:9:{s:2:\\"id\\";i:2;s:3:\\"key\\";s:22:\\"my_new_field_group_old\\";s:4:\\"slug\\";s:22:\\"my_new_field_group_old\\";s:4:\\"name\\";s:16:\\"Test field group\\";s:11:\\"description\\";s:22:\\"Test field description\\";s:10:\\"repeatable\\";i:1;s:6:\\"fields\\";a:1:{i:0;a:9:{s:4:\\"name\\";s:16:\\"A new text field\\";s:4:\\"slug\\";s:16:\\"my_new_textfield\\";s:11:\\"description\\";s:36:\\"Enter some text in my new text field\\";s:4:\\"type\\";s:4:\\"text\\";s:17:\\"type_post_options\\";a:2:{s:18:\\"enabled_post_types\\";a:0:{}s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:2:\\"id\\";i:0;s:7:\\"deleted\\";i:0;s:11:\\"field_group\\";a:6:{s:2:\\"id\\";i:2;s:4:\\"name\\";s:16:\\"Test field group\\";s:4:\\"slug\\";i:2;s:11:\\"description\\";s:22:\\"Test field description\\";s:10:\\"repeatable\\";i:1;s:12:\\"fields_count\\";i:1;}}}s:7:\\"deleted\\";b:0;s:12:\\"fields_count\\";i:1;}i:3;a:9:{s:2:\\"id\\";i:3;s:3:\\"key\\";s:29:\\"my_new_field_group_all_fields\\";s:4:\\"slug\\";s:29:\\"my_new_field_group_all_fields\\";s:4:\\"name\\";s:32:\\"Test field group with all fields\\";s:11:\\"description\\";s:22:\\"Test field description\\";s:10:\\"repeatable\\";i:1;s:6:\\"fields\\";a:12:{i:0;a:9:{s:4:\\"name\\";s:24:\\"A new field of type text\\";s:4:\\"slug\\";s:19:\\"slug_fieldtype_text\\";s:11:\\"description\\";s:34:\\"Description for field of type text\\";s:4:\\"type\\";s:4:\\"text\\";s:17:\\"type_post_options\\";a:2:{s:18:\\"enabled_post_types\\";a:0:{}s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:2:\\"id\\";i:0;s:7:\\"deleted\\";i:0;s:11:\\"field_group\\";a:6:{s:2:\\"id\\";i:3;s:4:\\"name\\";s:32:\\"Test field group with all fields\\";s:4:\\"slug\\";i:3;s:11:\\"description\\";s:22:\\"Test field description\\";s:10:\\"repeatable\\";i:1;s:12:\\"fields_count\\";i:12;}}i:1;a:9:{s:4:\\"name\\";s:28:\\"A new field of type textarea\\";s:4:\\"slug\\";s:23:\\"slug_fieldtype_textarea\\";s:11:\\"description\\";s:38:\\"Description for field of type textarea\\";s:4:\\"type\\";s:8:\\"textarea\\";s:17:\\"type_post_options\\";a:2:{s:18:\\"enabled_post_types\\";a:0:{}s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:2:\\"id\\";i:1;s:7:\\"deleted\\";i:0;s:11:\\"field_group\\";a:6:{s:2:\\"id\\";i:3;s:4:\\"name\\";s:32:\\"Test field group with all fields\\";s:4:\\"slug\\";i:3;s:11:\\"description\\";s:22:\\"Test field description\\";s:10:\\"repeatable\\";i:1;s:12:\\"fields_count\\";i:12;}}i:2;a:9:{s:4:\\"name\\";s:28:\\"A new field of type checkbox\\";s:4:\\"slug\\";s:23:\\"slug_fieldtype_checkbox\\";s:11:\\"description\\";s:38:\\"Description for field of type checkbox\\";s:4:\\"type\\";s:8:\\"checkbox\\";s:17:\\"type_post_options\\";a:2:{s:18:\\"enabled_post_types\\";a:0:{}s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:2:\\"id\\";i:2;s:7:\\"deleted\\";i:0;s:11:\\"field_group\\";a:6:{s:2:\\"id\\";i:3;s:4:\\"name\\";s:32:\\"Test field group with all fields\\";s:4:\\"slug\\";i:3;s:11:\\"description\\";s:22:\\"Test field description\\";s:10:\\"repeatable\\";i:1;s:12:\\"fields_count\\";i:12;}}i:3;a:9:{s:4:\\"name\\";s:31:\\"A new field of type radiobutton\\";s:4:\\"slug\\";s:26:\\"slug_fieldtype_radiobutton\\";s:11:\\"description\\";s:41:\\"Description for field of type radiobutton\\";s:4:\\"type\\";s:11:\\"radiobutton\\";s:17:\\"type_post_options\\";a:2:{s:18:\\"enabled_post_types\\";a:0:{}s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:2:\\"id\\";i:3;s:7:\\"deleted\\";i:0;s:11:\\"field_group\\";a:6:{s:2:\\"id\\";i:3;s:4:\\"name\\";s:32:\\"Test field group with all fields\\";s:4:\\"slug\\";i:3;s:11:\\"description\\";s:22:\\"Test field description\\";s:10:\\"repeatable\\";i:1;s:12:\\"fields_count\\";i:12;}}i:4;a:9:{s:4:\\"name\\";s:28:\\"A new field of type dropdown\\";s:4:\\"slug\\";s:23:\\"slug_fieldtype_dropdown\\";s:11:\\"description\\";s:38:\\"Description for field of type dropdown\\";s:4:\\"type\\";s:8:\\"dropdown\\";s:17:\\"type_post_options\\";a:2:{s:18:\\"enabled_post_types\\";a:0:{}s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:2:\\"id\\";i:4;s:7:\\"deleted\\";i:0;s:11:\\"field_group\\";a:6:{s:2:\\"id\\";i:3;s:4:\\"name\\";s:32:\\"Test field group with all fields\\";s:4:\\"slug\\";i:3;s:11:\\"description\\";s:22:\\"Test field description\\";s:10:\\"repeatable\\";i:1;s:12:\\"fields_count\\";i:12;}}i:5;a:9:{s:4:\\"name\\";s:24:\\"A new field of type file\\";s:4:\\"slug\\";s:19:\\"slug_fieldtype_file\\";s:11:\\"description\\";s:34:\\"Description for field of type file\\";s:4:\\"type\\";s:4:\\"file\\";s:17:\\"type_post_options\\";a:2:{s:18:\\"enabled_post_types\\";a:0:{}s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:2:\\"id\\";i:5;s:7:\\"deleted\\";i:0;s:11:\\"field_group\\";a:6:{s:2:\\"id\\";i:3;s:4:\\"name\\";s:32:\\"Test field group with all fields\\";s:4:\\"slug\\";i:3;s:11:\\"description\\";s:22:\\"Test field description\\";s:10:\\"repeatable\\";i:1;s:12:\\"fields_count\\";i:12;}}i:6;a:9:{s:4:\\"name\\";s:24:\\"A new field of type post\\";s:4:\\"slug\\";s:19:\\"slug_fieldtype_post\\";s:11:\\"description\\";s:34:\\"Description for field of type post\\";s:4:\\"type\\";s:4:\\"post\\";s:17:\\"type_post_options\\";a:2:{s:18:\\"enabled_post_types\\";a:0:{}s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:2:\\"id\\";i:6;s:7:\\"deleted\\";i:0;s:11:\\"field_group\\";a:6:{s:2:\\"id\\";i:3;s:4:\\"name\\";s:32:\\"Test field group with all fields\\";s:4:\\"slug\\";i:3;s:11:\\"description\\";s:22:\\"Test field description\\";s:10:\\"repeatable\\";i:1;s:12:\\"fields_count\\";i:12;}}i:7;a:9:{s:4:\\"name\\";s:28:\\"A new field of type taxonomy\\";s:4:\\"slug\\";s:23:\\"slug_fieldtype_taxonomy\\";s:11:\\"description\\";s:38:\\"Description for field of type taxonomy\\";s:4:\\"type\\";s:8:\\"taxonomy\\";s:17:\\"type_post_options\\";a:2:{s:18:\\"enabled_post_types\\";a:0:{}s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:2:\\"id\\";i:7;s:7:\\"deleted\\";i:0;s:11:\\"field_group\\";a:6:{s:2:\\"id\\";i:3;s:4:\\"name\\";s:32:\\"Test field group with all fields\\";s:4:\\"slug\\";i:3;s:11:\\"description\\";s:22:\\"Test field description\\";s:10:\\"repeatable\\";i:1;s:12:\\"fields_count\\";i:12;}}i:8;a:9:{s:4:\\"name\\";s:32:\\"A new field of type taxonomyterm\\";s:4:\\"slug\\";s:27:\\"slug_fieldtype_taxonomyterm\\";s:11:\\"description\\";s:42:\\"Description for field of type taxonomyterm\\";s:4:\\"type\\";s:12:\\"taxonomyterm\\";s:17:\\"type_post_options\\";a:2:{s:18:\\"enabled_post_types\\";a:0:{}s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:2:\\"id\\";i:8;s:7:\\"deleted\\";i:0;s:11:\\"field_group\\";a:6:{s:2:\\"id\\";i:3;s:4:\\"name\\";s:32:\\"Test field group with all fields\\";s:4:\\"slug\\";i:3;s:11:\\"description\\";s:22:\\"Test field description\\";s:10:\\"repeatable\\";i:1;s:12:\\"fields_count\\";i:12;}}i:9;a:9:{s:4:\\"name\\";s:25:\\"A new field of type color\\";s:4:\\"slug\\";s:20:\\"slug_fieldtype_color\\";s:11:\\"description\\";s:35:\\"Description for field of type color\\";s:4:\\"type\\";s:5:\\"color\\";s:17:\\"type_post_options\\";a:2:{s:18:\\"enabled_post_types\\";a:0:{}s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:2:\\"id\\";i:9;s:7:\\"deleted\\";i:0;s:11:\\"field_group\\";a:6:{s:2:\\"id\\";i:3;s:4:\\"name\\";s:32:\\"Test field group with all fields\\";s:4:\\"slug\\";i:3;s:11:\\"description\\";s:22:\\"Test field description\\";s:10:\\"repeatable\\";i:1;s:12:\\"fields_count\\";i:12;}}i:10;a:9:{s:4:\\"name\\";s:24:\\"A new field of type date\\";s:4:\\"slug\\";s:19:\\"slug_fieldtype_date\\";s:11:\\"description\\";s:34:\\"Description for field of type date\\";s:4:\\"type\\";s:4:\\"date\\";s:17:\\"type_post_options\\";a:2:{s:18:\\"enabled_post_types\\";a:0:{}s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:2:\\"id\\";i:10;s:7:\\"deleted\\";i:0;s:11:\\"field_group\\";a:6:{s:2:\\"id\\";i:3;s:4:\\"name\\";s:32:\\"Test field group with all fields\\";s:4:\\"slug\\";i:3;s:11:\\"description\\";s:22:\\"Test field description\\";s:10:\\"repeatable\\";i:1;s:12:\\"fields_count\\";i:12;}}i:11;a:9:{s:4:\\"name\\";s:24:\\"A new field of type user\\";s:4:\\"slug\\";s:19:\\"slug_fieldtype_user\\";s:11:\\"description\\";s:34:\\"Description for field of type user\\";s:4:\\"type\\";s:4:\\"user\\";s:17:\\"type_post_options\\";a:2:{s:18:\\"enabled_post_types\\";a:0:{}s:20:\\"additional_arguments\\";s:0:\\"\\";}s:25:\\"type_taxonomyterm_options\\";a:1:{s:20:\\"additional_arguments\\";s:0:\\"\\";}s:2:\\"id\\";i:11;s:7:\\"deleted\\";i:0;s:11:\\"field_group\\";a:6:{s:2:\\"id\\";i:3;s:4:\\"name\\";s:32:\\"Test field group with all fields\\";s:4:\\"slug\\";i:3;s:11:\\"description\\";s:22:\\"Test field description\\";s:10:\\"repeatable\\";i:1;s:12:\\"fields_count\\";i:12;}}}s:7:\\"deleted\\";b:0;s:12:\\"fields_count\\";i:12;}}', 'yes')
EOT;
        #'s:2:\"11\"';
        $stringlen = strlen($post_id);
        #echo "len: $stringlen";
        #echo "postid: $post_id";
        // replace %%THING1%% with string length and val of previosly inserted post
        $query = str_replace('%%THING1%%', 's:' . $stringlen . ':\\"' . $post_id . '\\"', $query);
        #$query = str_replace('%%THING1%%', 's:2:\"11\"', $query);
        #echo $query;
        $wpdb->query($query);
        $query = <<<EOT
\t\t\tINSERT INTO `{$wpdb->options}` (`option_name`, `option_value`, `autoload`)
\t\t\tVALUES
\t\t\t\t('simple_fields_post_connectors', 'a:1:{i:1;a:9:{s:2:\\"id\\";i:1;s:3:\\"key\\";s:23:\\"post_connector_manually\\";s:4:\\"slug\\";s:23:\\"post_connector_manually\\";s:4:\\"name\\";s:29:\\"Manually added post connector\\";s:12:\\"field_groups\\";a:1:{i:1;a:5:{s:2:\\"id\\";s:1:\\"1\\";s:4:\\"name\\";s:26:\\"Manually added field group\\";s:7:\\"deleted\\";s:1:\\"0\\";s:7:\\"context\\";s:6:\\"normal\\";s:8:\\"priority\\";s:4:\\"high\\";}}s:10:\\"post_types\\";a:2:{i:0;s:4:\\"post\\";i:1;s:4:\\"page\\";}s:7:\\"deleted\\";b:0;s:11:\\"hide_editor\\";b:0;s:18:\\"field_groups_count\\";i:1;}}', 'yes')
EOT;
        $wpdb->query($query);
        #sf_d( $this->factory->post->create_many( 5 ) );exit;
        #$post_id = 11;
        $query = <<<EOT
\t\t\tINSERT INTO `{$wpdb->postmeta}` (`post_id`, `meta_key`, `meta_value`)
\t\t\tVALUES
\t\t\t\t({$post_id}, '_simple_fields_selected_connector', '1'),
\t\t\t\t({$post_id}, '_simple_fields_been_saved', '1'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_14_numInSet_0', '2013-01-31 09:30'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_13_numInSet_0', '1'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_13_numInSet_1', '1'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_12_numInSet_1', '15/10/2012'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_12_numInSet_0', '12/10/2012'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_11_numInSet_0', 'FF3C26'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_11_numInSet_1', '8B33FF'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_10_numInSet_1', ''),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_10_numInSet_0', 'a:1:{i:0;s:1:\\"1\\";}'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_9_numInSet_1', 'category'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_9_numInSet_0', 'post_tag'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_8_numInSet_1', '5'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_8_numInSet_0', '{$post_id}'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_7_numInSet_1', '17'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_6_numInSet_1', 'dropdown_num_2'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_7_numInSet_0', '14'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_3_numInSet_0', '<p>Text entered in the TinyMCE-editor.</p>
'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_3_numInSet_1', '<p>Tiny editors are great!</p>
<p>You can style the content and insert images and stuff. Groovy! Funky!</p>
<h2>A list</h2>
<ul>
<li>List item 1</li>
<li>List item 2</li>
</ul>
<h2>And images can be inserted</h2>
<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>
'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_6_numInSet_0', 'dropdown_num_3'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_5_numInSet_1', 'radiobutton_num_2'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_4_numInSet_1', ''),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_5_numInSet_0', 'radiobutton_num_4'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_4_numInSet_0', '1'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_1_numInSet_1', 'text in textfield 2<span>yes it is</span>'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_2_numInSet_0', 'Text entered in the textarea'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_2_numInSet_1', 'Textera with more funky text in it.

<h2>Headline</h2>
<ul>
\t<li>Item 1</li>
\t<li>Item 2</li>
</ul>
'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_added_numInSet_0', '1'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_1_numInSet_0', 'Text entered in the text field'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_added_numInSet_1', '1'),
\t\t\t\t({$post_id}, '_simple_fields_fieldGroupID_1_fieldID_14_numInSet_1', '2012-12-10 18:00');
EOT;
        $wpdb->query($query);
        // Posts to test different connectors with
        $sql = "INSERT INTO `{$wpdb->posts}` (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`)\n\t\tVALUES\n\t\t\t(24, 1, '2012-10-11 11:07:42', '2012-10-11 11:07:42', '', 'Post with no connector', '', 'publish', 'open', 'open', '', 'post-with-not-connector', '', '', '2012-10-11 11:08:41', '2012-10-11 11:08:41', '', 0, 'http://unit-test.simple-fields.com/wordpress/?p=24', 0, 'post', '', 0),\n\t\t\t(26, 1, '2012-10-11 11:08:04', '2012-10-11 11:08:04', '', 'Post with inherit connector', '', 'publish', 'open', 'open', '', 'post-with-inherit-connector', '', '', '2012-10-11 11:08:29', '2012-10-11 11:08:29', '', 0, 'http://unit-test.simple-fields.com/wordpress/?p=26', 0, 'post', '', 0),\n\t\t\t(32, 1, '2012-10-11 11:39:31', '2012-10-11 11:39:31', '', 'Page with fields', '', 'publish', 'open', 'open', '', 'page-with-fields', '', '', '2012-10-11 11:39:31', '2012-10-11 11:39:31', '', 0, 'http://unit-test.simple-fields.com/wordpress/?page_id=32', 0, 'page', '', 0),\n\t\t\t(34, 1, '2012-10-11 11:39:43', '2012-10-11 11:39:43', '', 'Page with inherit connector (has parent with fields)', '', 'publish', 'open', 'open', '', 'page-with-inherit-connector', '', '', '2012-10-11 11:40:30', '2012-10-11 11:40:30', '', 32, 'http://unit-test.simple-fields.com/wordpress/?page_id=34', 0, 'page', '', 0),\n\t\t\t(36, 1, '2012-10-11 11:39:59', '2012-10-11 11:39:59', '', 'Post with no connector (has parent with fields)', '', 'publish', 'open', 'open', '', 'post-with-no-connector', '', '', '2012-10-11 11:40:10', '2012-10-11 11:40:10', '', 32, 'http://unit-test.simple-fields.com/wordpress/?page_id=36', 0, 'page', '', 0);\n\t\t";
        $wpdb->query($sql);
        // post_with_no_connector
        $sql = "INSERT INTO `{$wpdb->postmeta}` (`post_id`, `meta_key`, `meta_value`)\n\t\tVALUES\n\t\t\t(24, '_edit_lock', '1349955446:1'),\n\t\t\t(24, '_simple_fields_selected_connector', '__none__'),\n\t\t\t(24, '_edit_last', '1');";
        $wpdb->query($sql);
        // post_with_inherit_connector
        $sql = "INSERT INTO `{$wpdb->postmeta}` (`post_id`, `meta_key`, `meta_value`)\n\t\tVALUES\n\t\t\t(26, '_edit_last', '1'),\n\t\t\t(26, '_edit_lock', '1349953596:1'),\n\t\t\t(26, '_simple_fields_selected_connector', '__inherit__');";
        $wpdb->query($sql);
        // page_with_fields
        $sql = "INSERT INTO `{$wpdb->postmeta}` (`post_id`, `meta_key`, `meta_value`)\n\t\tVALUES\n\t\t\t(32, '_edit_last', '1'),\n\t\t\t(32, '_edit_lock', '1357241403:1'),\n\t\t\t(32, '_simple_fields_selected_connector', '1'),\n\t\t\t(32, '_wp_page_template', 'default');";
        $wpdb->query($sql);
        // page_with_no_connector
        $sql = "INSERT INTO `{$wpdb->postmeta}` (`post_id`, `meta_key`, `meta_value`)\n\t\tVALUES\n\t\t\t(36, '_edit_last', '1'),\n\t\t\t(36, '_edit_lock', '1349957025:1'),\n\t\t\t(36, '_simple_fields_selected_connector', '__none__'),\n\t\t\t(36, '_wp_page_template', 'default');";
        $wpdb->query($sql);
        // page_with_inherit_connector
        $sql = "INSERT INTO `{$wpdb->postmeta}` (`post_id`, `meta_key`, `meta_value`)\n\t\tVALUES\n\t\t\t(34, '_edit_last', '1'),\n\t\t\t(34, '_edit_lock', '1349955934:1'),\n\t\t\t(34, '_simple_fields_selected_connector', '__inherit__'),\n\t\t\t(34, '_wp_page_template', 'default');";
        $wpdb->query($sql);
        return $post_id;
    }
Example #4
0
<?php

include_once __DIR__ . "/../vendor/autoload.php";
use XLog\Logger;
class Foo
{
    public static function bar()
    {
        $logger = new Logger();
        $logger->log('error', 'Trace to log in bar');
    }
}
class BasicTest
{
    public static function go()
    {
        $logger = new Logger();
        $logger->log('info', 'Trace to log in go');
        Foo::bar();
    }
}
$logger = new Logger();
$logger->log('trace', 'Trace to log in base script');
BasicTest::go();