Code Duplication    Length = 27-28 lines in 2 locations

tests/test-GeoDirectory.php 2 locations

@@ 378-404 (lines=27) @@
375
376
    }
377
378
    public function testPopupSendEnquiryTemplate() {
379
380
        $query_args = array(
381
            'post_status' => 'publish',
382
            'post_type' => 'gd_place',
383
            'posts_per_page' => 1,
384
        );
385
386
        $all_posts = new WP_Query( $query_args );
387
        $post_id = null;
388
        while ( $all_posts->have_posts() ) : $all_posts->the_post();
389
            $post_id = get_the_ID();
390
        endwhile;
391
392
        $this->assertTrue(is_int($post_id));
393
394
        $_REQUEST['popuptype'] = 'b_send_inquiry';
395
        $_REQUEST['post_id'] = $post_id;
396
        add_filter('wp_redirect', '__return_false');
397
        ob_start();
398
        geodir_ajax_handler();
399
        $output = ob_get_contents();
400
        ob_end_clean();
401
        $this->assertContains('send_inqury', $output);
402
        remove_filter('wp_redirect', '__return_false');
403
404
    }
405
406
    public function texstPopupSendToFrndTemplate() {
407
@@ 406-433 (lines=28) @@
403
404
    }
405
406
    public function texstPopupSendToFrndTemplate() {
407
408
        //include template problem. its already loaded. find a way to fix this
409
410
        $query_args = array(
411
            'post_status' => 'publish',
412
            'post_type' => 'gd_place',
413
            'posts_per_page' => 1,
414
        );
415
416
        $all_posts = new WP_Query( $query_args );
417
        $post_id = null;
418
        while ( $all_posts->have_posts() ) : $all_posts->the_post();
419
            $post_id = get_the_ID();
420
        endwhile;
421
422
        $this->assertTrue(is_int($post_id));
423
424
        $_REQUEST['popuptype'] = 'b_sendtofriend';
425
        $_REQUEST['post_id'] = $post_id;
426
        add_filter('wp_redirect', '__return_false');
427
        ob_start();
428
        geodir_ajax_handler();
429
        $output = ob_get_contents();
430
        ob_end_clean();
431
        $this->assertContains('send_inqury', $output);
432
        remove_filter('wp_redirect', '__return_false');
433
    }
434
435
    public function testNavMenus() {
436
        $menuname = 'Primary Menu';