Example #1
0
/**
 * For each PMP post in the WP database, fetch the corresponding Doc from PMP and check if
 * the WP post differs from the PMP Doc. If it does differ, update the post in the WP database.
 *
 * @since 0.1
 */
function pmp_get_updates()
{
    pmp_debug('========== pmp_get_updates ==========');
    $posts = pmp_get_pmp_posts();
    foreach ($posts as $post) {
        $syncer = PmpPost::fromPost($post);
        $syncer->pull();
    }
}
Example #2
0
 function test_pmp_get_pmp_posts()
 {
     if ($this->skip) {
         $this->markTestSkipped('This test requires site options `pmp_api_url`, `pmp_client_id` and `pmp_client_secret`');
         return;
     }
     $posts = pmp_get_pmp_posts();
     $this->assertTrue(count($posts) == 1);
 }
 function test_pmp_post_is_mine()
 {
     $is_mine = pmp_post_is_mine($this->post);
     $this->assertTrue($is_mine);
     $pmp_posts = pmp_get_pmp_posts();
     $pmp_post = $pmp_posts[0];
     $is_mine = pmp_post_is_mine($pmp_post->ID);
     $this->assertTrue(!$is_mine);
 }