WordPress.org

Make WordPress Core

Changeset 29932


Ignore:
Timestamp:
10/17/2014 12:40:06 AM (6 years ago)
Author:
boonebgorges
Message:

Add expectedIncorrectUsage flags for unit tests that generate invalid dates.

Since [29925], passing an invalid date to WP_Date_Query will generate a
_doing_it_wrong() notice. The current changeset adds the
@expectedIncorrectUsage flag to those existing unit tests that generate
invalid dates, such as those that test canonical redirect and is_404()
conditionals.

Fixes #25834.

Location:
trunk/tests/phpunit/tests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/canonical.php

    r28966 r29932  
    107107     * @dataProvider data
    108108     */
    109     function test($test_url, $expected, $ticket = 0) {
     109    function test( $test_url, $expected, $ticket = 0, $expected_doing_it_wrong = array() ) {
     110        $this->expected_doing_it_wrong = array_merge( $this->expected_doing_it_wrong, (array) $expected_doing_it_wrong );
     111
    110112        if ( $ticket )
    111113            $this->knownWPBug( $ticket );
     
    247249
    248250            array( '/2012/13/', '/2012/'),
    249             array( '/2012/11/51/', '/2012/11/'),
     251            array( '/2012/11/51/', '/2012/11/', 0, array( 'WP_Date_Query' ) ),
    250252
    251253            // Authors
  • trunk/tests/phpunit/tests/query/conditionals.php

    r29039 r29932  
    604604    // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
    605605
     606    /**
     607     * @expectedIncorrectUsage WP_Date_Query
     608     */
    606609    function test_bad_dates() {
    607610        $this->go_to( '/2013/13/13/' );
  • trunk/tests/phpunit/tests/query/results.php

    r29765 r29932  
    574574        $this->assertFalse( $this->q->is_month );
    575575        $this->assertTrue( $this->q->is_year );
    576 
     576    }
     577
     578    /**
     579     * @ticket 10935
     580     * @expectedIncorrectUsage WP_Date_Query
     581     */
     582    public function test_query_is_date_with_bad_date() {
    577583        $this->q->query( array(
    578584            'year' => '2007',
Note: See TracChangeset for help on using the changeset viewer.