/** * Tests the document_revisions shortcode with a number=1 limit */ function test_revision_shortcode_limit() { $tdr = new WP_Test_Document_Revisions(); $docID = $tdr->test_revise_document(); //admin should be able to access $id = _make_user('administrator'); wp_set_current_user($id); $output = do_shortcode('[document_revisions number="1" id="' . $docID . '"]'); $this->assertEquals(1, substr_count($output, '<li'), 'revision shortcode count'); }
/** * Can a user with the proper feed key access a feed? */ function test_feed_as_authorized() { global $wpdr; define('WP_ADMIN', true); $wpdr->admin_init(); $tdr = new WP_Test_Document_Revisions(); $docID = $tdr->test_add_document(); //try to get an auth'd feed $userID = _make_user('administrator'); $key = $wpdr->admin->get_feed_key($userID); $content = $this->simulate_feed(add_query_arg('key', $key, get_permalink($docID) . '/feed/')); $this->assertTrue($wpdr->validate_feed_key(), 'not properly validating feed key'); $this->assertFalse($this->is_wp_die(), 'Not properly allowing access to feeds'); $this->assertEquals(count($wpdr->get_revisions($docID)), (int) substr_count($content, '<item>'), 'improper feed item count'); _destroy_user($userID); }