Code Duplication    Length = 17-19 lines in 4 locations

tests/phpunit/tests/query/conditionals.php 4 locations

@@ 137-153 (lines=17) @@
134
    }
135
136
    // '(about)/trackback/?$' => 'index.php?pagename=$matches[1]&tb=1'
137
    function test_page_trackback() 
138
    {
139
        $page_ids = array();
140
        $page_ids[] = $page_id = self::factory()->post->create(array( 'post_type' => 'page', 'post_title' => 'parent-page' ));
141
        $page_ids[] = $page_id = self::factory()->post->create(array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ));
142
        $page_ids[] = $page_id = self::factory()->post->create(array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ));
143
        foreach ( $page_ids as $page_id ) {
144
            $url = get_permalink($page_id);
145
            $this->go_to("{$url}trackback/");
146
147
            // make sure the correct wp_query flags are set
148
            $this->assertQueryTrue('is_page', 'is_singular', 'is_trackback');
149
150
            // make sure the correct page was fetched
151
            global $wp_query;
152
            $this->assertEquals($page_id, $wp_query->get_queried_object()->ID);
153
        }
154
    }
155
156
    //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
@@ 157-174 (lines=18) @@
154
    }
155
156
    //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
157
    function test_page_feed() 
158
    {
159
        $page_ids = array();
160
        $page_ids[] = $page_id = self::factory()->post->create(array( 'post_type' => 'page', 'post_title' => 'parent-page' ));
161
        $page_ids[] = $page_id = self::factory()->post->create(array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ));
162
        $page_ids[] = $page_id = self::factory()->post->create(array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ));
163
        foreach ( $page_ids as $page_id ) {
164
            self::factory()->comment->create_post_comments($page_id, 2);
165
            $url = get_permalink($page_id);
166
            $this->go_to("{$url}feed/");
167
168
            // make sure the correct wp_query flags are set
169
            $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
170
171
            // make sure the correct page was fetched
172
            global $wp_query;
173
            $this->assertEquals($page_id, $wp_query->get_queried_object()->ID);
174
        }
175
    }
176
177
    function test_page_feed_with_no_comments() 
@@ 177-193 (lines=17) @@
174
        }
175
    }
176
177
    function test_page_feed_with_no_comments() 
178
    {
179
        $page_ids = array();
180
        $page_ids[] = $page_id = self::factory()->post->create(array( 'post_type' => 'page', 'post_title' => 'parent-page' ));
181
        $page_ids[] = $page_id = self::factory()->post->create(array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ));
182
        $page_ids[] = $page_id = self::factory()->post->create(array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ));
183
        foreach ( $page_ids as $page_id ) {
184
            $url = get_permalink($page_id);
185
            $this->go_to("{$url}feed/");
186
187
            // make sure the correct wp_query flags are set
188
            $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
189
190
            // make sure the correct page was fetched
191
            global $wp_query;
192
            $this->assertEquals($page_id, $wp_query->get_queried_object()->ID);
193
        }
194
    }
195
196
    // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
@@ 197-215 (lines=19) @@
194
    }
195
196
    // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
197
    function test_page_feed_atom() 
198
    {
199
        $page_ids = array();
200
        $page_ids[] = $page_id = self::factory()->post->create(array( 'post_type' => 'page', 'post_title' => 'parent-page' ));
201
        $page_ids[] = $page_id = self::factory()->post->create(array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ));
202
        $page_ids[] = $page_id = self::factory()->post->create(array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ));
203
        foreach ( $page_ids as $page_id ) {
204
            self::factory()->comment->create_post_comments($page_id, 2);
205
206
            $url = get_permalink($page_id);
207
            $this->go_to("{$url}feed/atom/");
208
209
            // make sure the correct wp_query flags are set
210
            $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
211
212
            // make sure the correct page was fetched
213
            global $wp_query;
214
            $this->assertEquals($page_id, $wp_query->get_queried_object()->ID);
215
        }
216
    }
217
218
    // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'