Make WordPress Core


Ignore:
Timestamp:
09/11/2013 06:45:34 PM (13 years ago)
Author:
wonderboymusic
Message:

Avoid the following notice: Use of undefined constant term_id - assumed 'term_id', while running in debug mode.

See #25282.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/query/results.php

    r25280 r25356  
    111111        function test_query_tag_id() {
    112112                $tag = tag_exists('tag-a');
    113                 $posts = $this->q->query("tag_id={$tag[term_id]}");
     113                $posts = $this->q->query( "tag_id=" . $tag['term_id'] );
    114114
    115115                // there are 4 posts with Tag A
     
    138138                $tag_a = tag_exists('tag-a');
    139139                $tag_b = tag_exists('tag-b');
    140                 $posts = $this->q->query("tag__in[]={$tag_a[term_id]}&tag__in[]={$tag_b[term_id]}");
     140                $posts = $this->q->query( "tag__in[]=". $tag_a['term_id'] . "&tag__in[]=" . $tag_b['term_id'] );
    141141
    142142                // there are 6 posts with either Tag A or Tag B
     
    152152        function test_query_tag__not_in() {
    153153                $tag_a = tag_exists('tag-a');
    154                 $posts = $this->q->query("tag__not_in[]={$tag_a[term_id]}");
     154                $posts = $this->q->query( "tag__not_in[]=" . $tag_a['term_id'] );
    155155
    156156                // the most recent 10 posts with Tag A excluded
     
    175175                $tag_a = tag_exists('tag-a');
    176176                $tag_b = tag_exists('tag-b');
    177                 $posts = $this->q->query("tag__in[]={$tag_a[term_id]}&tag__not_in[]={$tag_b[term_id]}");
     177                $posts = $this->q->query( "tag__in[]=" . $tag_a['term_id'] . "&tag__not_in[]=" . $tag_b['term_id'] );
    178178
    179179                // there are 4 posts with Tag A, only 2 when we exclude Tag B
Note: See TracChangeset for help on using the changeset viewer.