/** * Setup each test. * * @since 2.1 * @group search */ public function setUp() { global $wpdb; parent::setUp(); $wpdb->suppress_errors(); $admin_id = $this->factory->user->create(array('role' => 'administrator')); wp_set_current_user($admin_id); ep_delete_index(); ep_put_mapping(); EP_WP_Query_Integration::factory()->setup(); EP_Sync_Manager::factory()->setup(); EP_Sync_Manager::factory()->sync_post_queue = array(); $this->setup_test_post_type(); }
/** * Test a post sync on meta update * * @since 2.0 */ public function testPostSyncOnMetaUpdate() { add_action('ep_sync_on_meta_update', array($this, 'action_sync_on_meta_update'), 10, 0); $post_id = ep_create_and_sync_post(); ep_refresh_index(); update_post_meta($post_id, 'test', 1); $this->fired_actions = array(); update_post_meta($post_id, 'test', 2); EP_Sync_Manager::factory()->action_index_sync_queue(); $this->assertTrue(!empty($this->fired_actions['ep_sync_on_meta_update'])); $post = ep_get_post($post_id); $this->assertTrue(!empty($post)); }
/** * Accessor functions for methods in above class. See doc blocks above for function details. */ function ep_sync_post($post_id) { return EP_Sync_Manager::factory()->sync_post($post_id); }
/** * Accessor functions for methods in above class. See doc blocks above for function details. */ function ep_sync_post($post_id, $blocking = true) { return EP_Sync_Manager::factory()->sync_post($post_id, $blocking); }