@@ -1,138 +1,138 @@ |
||
1 | 1 | <?php |
2 | 2 | class CheckShortcodes extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - wp_set_current_user(1); |
|
8 | - |
|
9 | - } |
|
10 | - |
|
11 | - public function testHomeMapShortcode() |
|
12 | - { |
|
13 | - $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]'); |
|
14 | - $this->assertContains( 'geodir-map-home-page', $output ); |
|
15 | - } |
|
16 | - |
|
17 | - public function testListingMapShortcode() |
|
18 | - { |
|
19 | - $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]'); |
|
20 | - $this->assertContains( 'geodir-map-listing-page', $output ); |
|
21 | - } |
|
22 | - |
|
23 | - public function testListingSliderShortcode() |
|
24 | - { |
|
25 | - $output = do_shortcode('[gd_listing_slider post_number=5 category=3 slideshow=true show_featured_only=true]'); |
|
26 | - $this->assertContains( 'geodir_widget_carousel', $output ); |
|
27 | - } |
|
28 | - |
|
29 | - public function testLoginBoxShortcode() |
|
30 | - { |
|
31 | - $output = do_shortcode('[gd_login_box]'); |
|
32 | - $this->assertContains( 'geodir-loginbox-list', $output ); |
|
33 | - } |
|
34 | - |
|
35 | - public function texstPopPostCatShortcode() |
|
36 | - { |
|
37 | - global $geodir_post_type; |
|
38 | - $geodir_post_type = 'gd_place'; |
|
39 | - $output = do_shortcode('[gd_popular_post_category category_limit=30]'); |
|
40 | - $this->assertContains( 'geodir-popular-cat-list', $output ); |
|
41 | - } |
|
42 | - |
|
43 | - public function testPopPostViewShortcode() |
|
44 | - { |
|
45 | - $output = do_shortcode('[gd_popular_post_view category=3 layout=5 add_location_filter=true character_count=0 show_featured_only=true]'); |
|
46 | - $this->assertContains( 'geodir_category_list_view', $output ); |
|
47 | - } |
|
48 | - |
|
49 | - public function testRecentReviewsShortcode() |
|
50 | - { |
|
51 | - $query_args = array( |
|
52 | - 'post_status' => 'publish', |
|
53 | - 'post_type' => 'gd_place', |
|
54 | - 'posts_per_page' => 1, |
|
55 | - ); |
|
56 | - |
|
57 | - $all_posts = new WP_Query( $query_args ); |
|
58 | - $post_id = null; |
|
59 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
60 | - $post_id = get_the_ID(); |
|
61 | - endwhile; |
|
62 | - |
|
63 | - $this->assertTrue(is_int($post_id)); |
|
64 | - |
|
65 | - $time = current_time('mysql'); |
|
66 | - |
|
67 | - $data = array( |
|
68 | - 'comment_post_ID' => $post_id, |
|
69 | - 'comment_author' => 'admin', |
|
70 | - 'comment_author_email' => '[email protected]', |
|
71 | - 'comment_author_url' => 'http://wpgeodirectory.com', |
|
72 | - 'comment_content' => 'content here testtcc', |
|
73 | - 'comment_type' => '', |
|
74 | - 'comment_parent' => 0, |
|
75 | - 'user_id' => 1, |
|
76 | - 'comment_author_IP' => '127.0.0.1', |
|
77 | - 'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)', |
|
78 | - 'comment_date' => $time, |
|
79 | - 'comment_approved' => 1, |
|
80 | - ); |
|
81 | - |
|
82 | - $comment_id = wp_insert_comment($data); |
|
83 | - |
|
84 | - $_REQUEST['geodir_overallrating'] = 5.0; |
|
85 | - geodir_save_rating($comment_id); |
|
86 | - |
|
87 | - $output = do_shortcode('[gd_recent_reviews count=5]'); |
|
88 | - $this->assertContains( 'geodir_sc_recent_reviews', $output ); |
|
89 | - } |
|
90 | - |
|
91 | - public function texstRelatedListingsShortcode() |
|
92 | - { |
|
93 | - $query_args = array( |
|
94 | - 'post_status' => 'publish', |
|
95 | - 'post_type' => 'gd_place', |
|
96 | - 'posts_per_page' => 1, |
|
97 | - ); |
|
98 | - |
|
99 | - $all_posts = new WP_Query( $query_args ); |
|
100 | - $post_id = null; |
|
101 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
102 | - $post_id = get_the_ID(); |
|
103 | - global $post; |
|
104 | - $post = geodir_get_post_info($post_id); |
|
105 | - setup_postdata($post); |
|
106 | - $output = do_shortcode('[gd_related_listings relate_to=category layout=3 add_location_filter=0 list_sort=featured character_count=0]'); |
|
107 | - $this->assertContains( 'geodir_location_listing', $output ); |
|
108 | - endwhile; |
|
109 | - |
|
110 | - $this->assertTrue(is_int($post_id)); |
|
111 | - |
|
112 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + wp_set_current_user(1); |
|
8 | + |
|
9 | + } |
|
10 | + |
|
11 | + public function testHomeMapShortcode() |
|
12 | + { |
|
13 | + $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]'); |
|
14 | + $this->assertContains( 'geodir-map-home-page', $output ); |
|
15 | + } |
|
16 | + |
|
17 | + public function testListingMapShortcode() |
|
18 | + { |
|
19 | + $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]'); |
|
20 | + $this->assertContains( 'geodir-map-listing-page', $output ); |
|
21 | + } |
|
22 | + |
|
23 | + public function testListingSliderShortcode() |
|
24 | + { |
|
25 | + $output = do_shortcode('[gd_listing_slider post_number=5 category=3 slideshow=true show_featured_only=true]'); |
|
26 | + $this->assertContains( 'geodir_widget_carousel', $output ); |
|
27 | + } |
|
28 | + |
|
29 | + public function testLoginBoxShortcode() |
|
30 | + { |
|
31 | + $output = do_shortcode('[gd_login_box]'); |
|
32 | + $this->assertContains( 'geodir-loginbox-list', $output ); |
|
33 | + } |
|
34 | + |
|
35 | + public function texstPopPostCatShortcode() |
|
36 | + { |
|
37 | + global $geodir_post_type; |
|
38 | + $geodir_post_type = 'gd_place'; |
|
39 | + $output = do_shortcode('[gd_popular_post_category category_limit=30]'); |
|
40 | + $this->assertContains( 'geodir-popular-cat-list', $output ); |
|
41 | + } |
|
42 | + |
|
43 | + public function testPopPostViewShortcode() |
|
44 | + { |
|
45 | + $output = do_shortcode('[gd_popular_post_view category=3 layout=5 add_location_filter=true character_count=0 show_featured_only=true]'); |
|
46 | + $this->assertContains( 'geodir_category_list_view', $output ); |
|
47 | + } |
|
48 | + |
|
49 | + public function testRecentReviewsShortcode() |
|
50 | + { |
|
51 | + $query_args = array( |
|
52 | + 'post_status' => 'publish', |
|
53 | + 'post_type' => 'gd_place', |
|
54 | + 'posts_per_page' => 1, |
|
55 | + ); |
|
56 | + |
|
57 | + $all_posts = new WP_Query( $query_args ); |
|
58 | + $post_id = null; |
|
59 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
60 | + $post_id = get_the_ID(); |
|
61 | + endwhile; |
|
62 | + |
|
63 | + $this->assertTrue(is_int($post_id)); |
|
64 | + |
|
65 | + $time = current_time('mysql'); |
|
66 | + |
|
67 | + $data = array( |
|
68 | + 'comment_post_ID' => $post_id, |
|
69 | + 'comment_author' => 'admin', |
|
70 | + 'comment_author_email' => '[email protected]', |
|
71 | + 'comment_author_url' => 'http://wpgeodirectory.com', |
|
72 | + 'comment_content' => 'content here testtcc', |
|
73 | + 'comment_type' => '', |
|
74 | + 'comment_parent' => 0, |
|
75 | + 'user_id' => 1, |
|
76 | + 'comment_author_IP' => '127.0.0.1', |
|
77 | + 'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)', |
|
78 | + 'comment_date' => $time, |
|
79 | + 'comment_approved' => 1, |
|
80 | + ); |
|
81 | + |
|
82 | + $comment_id = wp_insert_comment($data); |
|
83 | + |
|
84 | + $_REQUEST['geodir_overallrating'] = 5.0; |
|
85 | + geodir_save_rating($comment_id); |
|
86 | + |
|
87 | + $output = do_shortcode('[gd_recent_reviews count=5]'); |
|
88 | + $this->assertContains( 'geodir_sc_recent_reviews', $output ); |
|
89 | + } |
|
90 | + |
|
91 | + public function texstRelatedListingsShortcode() |
|
92 | + { |
|
93 | + $query_args = array( |
|
94 | + 'post_status' => 'publish', |
|
95 | + 'post_type' => 'gd_place', |
|
96 | + 'posts_per_page' => 1, |
|
97 | + ); |
|
98 | + |
|
99 | + $all_posts = new WP_Query( $query_args ); |
|
100 | + $post_id = null; |
|
101 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
102 | + $post_id = get_the_ID(); |
|
103 | + global $post; |
|
104 | + $post = geodir_get_post_info($post_id); |
|
105 | + setup_postdata($post); |
|
106 | + $output = do_shortcode('[gd_related_listings relate_to=category layout=3 add_location_filter=0 list_sort=featured character_count=0]'); |
|
107 | + $this->assertContains( 'geodir_location_listing', $output ); |
|
108 | + endwhile; |
|
109 | + |
|
110 | + $this->assertTrue(is_int($post_id)); |
|
111 | + |
|
112 | + } |
|
113 | 113 | |
114 | - public function texstListingsShortcode() |
|
115 | - { |
|
116 | - $output = do_shortcode('[gd_listings post_type="gd_place" category="1,3" post_number="10" list_sort="high_review"]'); |
|
117 | - $this->assertContains( 'geodir-sc-gd-listings', $output ); |
|
118 | - } |
|
119 | - |
|
120 | - public function texstBestOfWidgetShortcode() |
|
121 | - { |
|
122 | - $output = do_shortcode('[gd_bestof_widget title="widget title" post_type=gd_hotel post_limit=5 categ_limit=6 character_count=50 use_viewing_post_type=true add_location_filter=true tab_layout=bestof-tabs-as-dropdown]'); |
|
123 | - $this->assertContains( 'geodir_bestof_widget', $output ); |
|
124 | - } |
|
125 | - |
|
126 | - public function testAddListingShortcode() |
|
127 | - { |
|
128 | - $_REQUEST['listing_type'] = 'gd_place'; |
|
129 | - $output = do_shortcode('[gd_add_listing listing_type=gd_place login_msg="Please register and login to submit listings" show_login=true]'); |
|
130 | - $this->assertContains( 'geodir-add-listing-submit', $output ); |
|
131 | - } |
|
132 | - |
|
133 | - public function tearDown() |
|
134 | - { |
|
135 | - parent::tearDown(); |
|
136 | - } |
|
114 | + public function texstListingsShortcode() |
|
115 | + { |
|
116 | + $output = do_shortcode('[gd_listings post_type="gd_place" category="1,3" post_number="10" list_sort="high_review"]'); |
|
117 | + $this->assertContains( 'geodir-sc-gd-listings', $output ); |
|
118 | + } |
|
119 | + |
|
120 | + public function texstBestOfWidgetShortcode() |
|
121 | + { |
|
122 | + $output = do_shortcode('[gd_bestof_widget title="widget title" post_type=gd_hotel post_limit=5 categ_limit=6 character_count=50 use_viewing_post_type=true add_location_filter=true tab_layout=bestof-tabs-as-dropdown]'); |
|
123 | + $this->assertContains( 'geodir_bestof_widget', $output ); |
|
124 | + } |
|
125 | + |
|
126 | + public function testAddListingShortcode() |
|
127 | + { |
|
128 | + $_REQUEST['listing_type'] = 'gd_place'; |
|
129 | + $output = do_shortcode('[gd_add_listing listing_type=gd_place login_msg="Please register and login to submit listings" show_login=true]'); |
|
130 | + $this->assertContains( 'geodir-add-listing-submit', $output ); |
|
131 | + } |
|
132 | + |
|
133 | + public function tearDown() |
|
134 | + { |
|
135 | + parent::tearDown(); |
|
136 | + } |
|
137 | 137 | } |
138 | 138 | ?> |
139 | 139 | \ No newline at end of file |
@@ -11,25 +11,25 @@ discard block |
||
11 | 11 | public function testHomeMapShortcode() |
12 | 12 | { |
13 | 13 | $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]'); |
14 | - $this->assertContains( 'geodir-map-home-page', $output ); |
|
14 | + $this->assertContains('geodir-map-home-page', $output); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | public function testListingMapShortcode() |
18 | 18 | { |
19 | 19 | $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]'); |
20 | - $this->assertContains( 'geodir-map-listing-page', $output ); |
|
20 | + $this->assertContains('geodir-map-listing-page', $output); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | public function testListingSliderShortcode() |
24 | 24 | { |
25 | 25 | $output = do_shortcode('[gd_listing_slider post_number=5 category=3 slideshow=true show_featured_only=true]'); |
26 | - $this->assertContains( 'geodir_widget_carousel', $output ); |
|
26 | + $this->assertContains('geodir_widget_carousel', $output); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | public function testLoginBoxShortcode() |
30 | 30 | { |
31 | 31 | $output = do_shortcode('[gd_login_box]'); |
32 | - $this->assertContains( 'geodir-loginbox-list', $output ); |
|
32 | + $this->assertContains('geodir-loginbox-list', $output); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function texstPopPostCatShortcode() |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | global $geodir_post_type; |
38 | 38 | $geodir_post_type = 'gd_place'; |
39 | 39 | $output = do_shortcode('[gd_popular_post_category category_limit=30]'); |
40 | - $this->assertContains( 'geodir-popular-cat-list', $output ); |
|
40 | + $this->assertContains('geodir-popular-cat-list', $output); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function testPopPostViewShortcode() |
44 | 44 | { |
45 | 45 | $output = do_shortcode('[gd_popular_post_view category=3 layout=5 add_location_filter=true character_count=0 show_featured_only=true]'); |
46 | - $this->assertContains( 'geodir_category_list_view', $output ); |
|
46 | + $this->assertContains('geodir_category_list_view', $output); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | public function testRecentReviewsShortcode() |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | 'posts_per_page' => 1, |
55 | 55 | ); |
56 | 56 | |
57 | - $all_posts = new WP_Query( $query_args ); |
|
57 | + $all_posts = new WP_Query($query_args); |
|
58 | 58 | $post_id = null; |
59 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
59 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
60 | 60 | $post_id = get_the_ID(); |
61 | 61 | endwhile; |
62 | 62 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | geodir_save_rating($comment_id); |
86 | 86 | |
87 | 87 | $output = do_shortcode('[gd_recent_reviews count=5]'); |
88 | - $this->assertContains( 'geodir_sc_recent_reviews', $output ); |
|
88 | + $this->assertContains('geodir_sc_recent_reviews', $output); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | public function texstRelatedListingsShortcode() |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | 'posts_per_page' => 1, |
97 | 97 | ); |
98 | 98 | |
99 | - $all_posts = new WP_Query( $query_args ); |
|
99 | + $all_posts = new WP_Query($query_args); |
|
100 | 100 | $post_id = null; |
101 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
101 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
102 | 102 | $post_id = get_the_ID(); |
103 | 103 | global $post; |
104 | - $post = geodir_get_post_info($post_id); |
|
104 | + $post = geodir_get_post_info($post_id); |
|
105 | 105 | setup_postdata($post); |
106 | 106 | $output = do_shortcode('[gd_related_listings relate_to=category layout=3 add_location_filter=0 list_sort=featured character_count=0]'); |
107 | - $this->assertContains( 'geodir_location_listing', $output ); |
|
107 | + $this->assertContains('geodir_location_listing', $output); |
|
108 | 108 | endwhile; |
109 | 109 | |
110 | 110 | $this->assertTrue(is_int($post_id)); |
@@ -114,20 +114,20 @@ discard block |
||
114 | 114 | public function texstListingsShortcode() |
115 | 115 | { |
116 | 116 | $output = do_shortcode('[gd_listings post_type="gd_place" category="1,3" post_number="10" list_sort="high_review"]'); |
117 | - $this->assertContains( 'geodir-sc-gd-listings', $output ); |
|
117 | + $this->assertContains('geodir-sc-gd-listings', $output); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | public function texstBestOfWidgetShortcode() |
121 | 121 | { |
122 | 122 | $output = do_shortcode('[gd_bestof_widget title="widget title" post_type=gd_hotel post_limit=5 categ_limit=6 character_count=50 use_viewing_post_type=true add_location_filter=true tab_layout=bestof-tabs-as-dropdown]'); |
123 | - $this->assertContains( 'geodir_bestof_widget', $output ); |
|
123 | + $this->assertContains('geodir_bestof_widget', $output); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | public function testAddListingShortcode() |
127 | 127 | { |
128 | 128 | $_REQUEST['listing_type'] = 'gd_place'; |
129 | 129 | $output = do_shortcode('[gd_add_listing listing_type=gd_place login_msg="Please register and login to submit listings" show_login=true]'); |
130 | - $this->assertContains( 'geodir-add-listing-submit', $output ); |
|
130 | + $this->assertContains('geodir-add-listing-submit', $output); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | public function tearDown() |