public function testSaveWithAutoSync() { // Set API settings to not auto sync and to enable the meta box $this->settings->set('api_autosync', 'yes'); $this->settings->set('show_metabox', 'yes'); // Create post $post_id = $this->factory->post->create(); // Create post data $_POST['post_ID'] = $post_id; $_POST['apple_news_sections'] = array('https://u48r14.digitalhub.com/sections/1234567890'); $_POST['apple_news_is_preview'] = 0; $_POST['apple_news_pullquote'] = 'test pullquote'; $_POST['apple_news_pullquote_position'] = 'middle'; $_POST['apple_news_nonce'] = wp_create_nonce('apple_news_publish'); $_POST['apple_news_publish_action'] = 'apple_news_publish'; // Create the meta box class and simulate a save $meta_box = new Admin_Apple_Meta_Boxes($this->settings); if ('yes' == $this->settings->get('show_metabox')) { $meta_box->do_publish($post_id, get_post($post_id)); } // Check the meta values $this->assertEquals(array('https://u48r14.digitalhub.com/sections/1234567890'), get_post_meta($post_id, 'apple_news_sections', true)); $this->assertEquals(false, get_post_meta($post_id, 'apple_news_is_preview', true)); $this->assertEquals('test pullquote', get_post_meta($post_id, 'apple_news_pullquote', true)); $this->assertEquals('middle', get_post_meta($post_id, 'apple_news_pullquote_position', true)); }