/** * Try to revise an existing document (creates that document first) * @return int the revision ID */ function test_revise_document() { $docID = WP_Test_Document_Revisions::test_add_document(); $attach_id = $this->spoof_upload($docID, $this->test_file2); $post = array('ID' => $docID, 'post_content' => $attach_id, 'post_excerpt' => 'revised'); $result = wp_update_post($post); wp_cache_flush(); $this->assertGreaterThan(0, $result, 'Cannot update document post_content with revised attachment ID'); $this->verify_attachment_matches_file($result, $this->test_file2, 'revise document'); return $result; }
/** * Tests that changing the document slug is reflected in permalinks */ function test_document_slug() { global $wp_rewrite; $tdr = new WP_Test_Document_Revisions(); //set new slug update_site_option('document_slug', 'docs'); //add doc and flush $docID = $tdr->test_add_document(); wp_publish_post($docID); wp_cache_flush(); $this->verify_download(get_permalink($docID), $tdr->test_file, 'revised document slug permalink doesn\'t rewrite'); $this->assertContains('/docs/', get_permalink($docID), 'revised document slug not in permalink'); }
/** * Tests the get_revisions function */ function test_get_document_revisions() { $tdr = new WP_Test_Document_Revisions(); $docID = $tdr->test_revise_document(); //add a doc $this->assertCount(2, get_document_revisions($docID)); }