@@ -3,32 +3,32 @@ discard block |
||
3 | 3 | $_SERVER['SERVER_NAME'] = ''; |
4 | 4 | $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php'; |
5 | 5 | |
6 | -define( 'GD_USE_PHP_SESSIONS', false ); |
|
7 | -define( 'GD_TESTING_MODE', true ); |
|
6 | +define('GD_USE_PHP_SESSIONS', false); |
|
7 | +define('GD_TESTING_MODE', true); |
|
8 | 8 | |
9 | -$_tests_dir = getenv( 'WP_TESTS_DIR' ); |
|
9 | +$_tests_dir = getenv('WP_TESTS_DIR'); |
|
10 | 10 | |
11 | -$is_selenium_test = getenv( 'IS_SELENIUM_TEST' ); |
|
11 | +$is_selenium_test = getenv('IS_SELENIUM_TEST'); |
|
12 | 12 | |
13 | -if ( ! $is_selenium_test ) { |
|
13 | +if (!$is_selenium_test) { |
|
14 | 14 | $is_selenium_test = false; |
15 | 15 | } else { |
16 | 16 | $is_selenium_test = true; |
17 | 17 | } |
18 | 18 | |
19 | -if ( ! $_tests_dir ) { |
|
20 | - $_tests_dir = dirname( __FILE__ ) . '/lib/wordpress-tests-lib'; |
|
19 | +if (!$_tests_dir) { |
|
20 | + $_tests_dir = dirname(__FILE__) . '/lib/wordpress-tests-lib'; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | require_once $_tests_dir . '/includes/functions.php'; |
24 | 24 | require $_tests_dir . '/includes/bootstrap.php'; |
25 | 25 | |
26 | -if ( $is_selenium_test ) { |
|
27 | - require dirname( __FILE__ ) . '/selenium/base.php'; |
|
26 | +if ($is_selenium_test) { |
|
27 | + require dirname(__FILE__) . '/selenium/base.php'; |
|
28 | 28 | } |
29 | 29 | |
30 | -if ( ! $is_selenium_test ) { |
|
31 | - require dirname( __FILE__ ) . '/../geodirectory.php'; |
|
30 | +if (!$is_selenium_test) { |
|
31 | + require dirname(__FILE__) . '/../geodirectory.php'; |
|
32 | 32 | tests_add_filter('place_dummy_image_url', 'place_dummy_image_url'); |
33 | 33 | tests_add_filter('place_dummy_cat_image_url', 'place_dummy_cat_image_url'); |
34 | 34 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | // unset($_REQUEST['_wpnonce']); |
113 | 113 | |
114 | 114 | $i = 2; |
115 | - while($i <= $max) { |
|
115 | + while ($i <= $max) { |
|
116 | 116 | global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2; |
117 | 117 | |
118 | 118 | $dummy_post_index = $i; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $city_bound_lat2 = 40.91525559999999; |
122 | 122 | $city_bound_lng2 = -73.7002721; |
123 | 123 | |
124 | - include dirname( __FILE__ ) . '/../geodirectory-admin/place_dummy_post.php'; |
|
124 | + include dirname(__FILE__) . '/../geodirectory-admin/place_dummy_post.php'; |
|
125 | 125 | $i++; |
126 | 126 | } |
127 | 127 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | function place_dummy_image_url($url) { |
140 | - $gd_dummy_base_url = getenv( 'GD_DUMMY_BASE_URL' ); |
|
140 | + $gd_dummy_base_url = getenv('GD_DUMMY_BASE_URL'); |
|
141 | 141 | if ($gd_dummy_base_url) { |
142 | 142 | return $gd_dummy_base_url; |
143 | 143 | } else { |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | function place_dummy_cat_image_url($url) { |
149 | - $gd_dummy_base_url = getenv( 'GD_DUMMY_BASE_URL' ); |
|
149 | + $gd_dummy_base_url = getenv('GD_DUMMY_BASE_URL'); |
|
150 | 150 | if ($gd_dummy_base_url) { |
151 | - return $gd_dummy_base_url."/cat_icon"; |
|
151 | + return $gd_dummy_base_url . "/cat_icon"; |
|
152 | 152 | } else { |
153 | 153 | return $url; |
154 | 154 | } |
@@ -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() |
@@ -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 | - } |
|
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 | - } |
|
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 | + |
|
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 |