Make WordPress Core

Changeset 143 in tests for wp-testcase/test_query.php


Ignore:
Timestamp:
12/23/2007 09:17:53 PM (19 years ago)
Author:
tellyworth
Message:

more query tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_query.php

    r128 r143  
    265265
    266266        // 'comments/page/?([0-9]{1,})/?$' => 'index.php?&paged=$matches[1]',
    267         // FIXME: what is this used for?
    268267        function test_comments_page() {
    269268                $this->http('/comments/page/2/');
     
    484483
    485484        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1',
     485        function test_post_trackback() {
     486                foreach ($this->_all_post_ids() as $id) {
     487                        $permalink = get_permalink($id);
     488                        $this->http("{$permalink}trackback/");
     489                        $this->assertQueryTrue('is_single', 'is_trackback');
     490                }
     491        }
     492
    486493        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
    487494        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
     495        function test_post_comment_feed() {
     496                foreach ($this->_all_post_ids() as $id) {
     497                        $permalink = get_permalink($id);
     498                       
     499                        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     500                        foreach ($types as $type) {
     501                                        $this->http("{$permalink}feed/{$type}");
     502                                        $this->assertQueryTrue('is_single', 'is_feed', 'is_comment_feed');
     503                        }
     504
     505                        // check the short form
     506                        $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     507                        foreach ($types as $type) {
     508                                        $this->http("{$permalink}{$type}");
     509                                        $this->assertQueryTrue('is_single', 'is_feed', 'is_comment_feed');
     510                        }
     511
     512                }
     513        }
     514
    488515        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&paged=$matches[5]',
    489516        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]',
     517        function test_post_paged() {
     518                // the long version
     519                $this->http('/2007/09/04/a-post-with-multiple-pages/page/2/');
     520                $this->assertQueryTrue('is_single');
     521               
     522                // and the short version
     523                $this->http('/2007/09/04/a-post-with-multiple-pages/2/');
     524                $this->assertQueryTrue('is_single', 'is_paged');
     525               
     526        }
     527       
    490528        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
     529        function test_post_attachment() {
     530                $permalink = get_attachment_link(8);
     531                dmp($permalink);
     532                $this->http($permalink);
     533                $this->assertQueryTrue('is_attachment');
     534        }
     535       
    491536        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
    492537        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
     
    498543        //
    499544
     545
     546
    500547}
    501548
Note: See TracChangeset for help on using the changeset viewer.