@@ -1,68 +1,68 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class UserTest extends WP_UnitTestCase |
| 3 | 3 | { |
| 4 | - public function setUp() |
|
| 5 | - { |
|
| 6 | - parent::setUp(); |
|
| 7 | - wp_set_current_user(1); |
|
| 8 | - } |
|
| 4 | + public function setUp() |
|
| 5 | + { |
|
| 6 | + parent::setUp(); |
|
| 7 | + wp_set_current_user(1); |
|
| 8 | + } |
|
| 9 | 9 | |
| 10 | - public function testDisplayUserFavorites() { |
|
| 10 | + public function testDisplayUserFavorites() { |
|
| 11 | 11 | |
| 12 | - global $current_user; |
|
| 12 | + global $current_user; |
|
| 13 | 13 | |
| 14 | - $user_id = $current_user->ID; |
|
| 14 | + $user_id = $current_user->ID; |
|
| 15 | 15 | |
| 16 | - $query_args = array( |
|
| 17 | - 'post_status' => 'publish', |
|
| 18 | - 'post_type' => 'gd_place', |
|
| 19 | - 'posts_per_page' => 1, |
|
| 20 | - ); |
|
| 16 | + $query_args = array( |
|
| 17 | + 'post_status' => 'publish', |
|
| 18 | + 'post_type' => 'gd_place', |
|
| 19 | + 'posts_per_page' => 1, |
|
| 20 | + ); |
|
| 21 | 21 | |
| 22 | - $all_posts = new WP_Query( $query_args ); |
|
| 23 | - $post_id = null; |
|
| 24 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 25 | - $post_id = get_the_ID(); |
|
| 26 | - endwhile; |
|
| 22 | + $all_posts = new WP_Query( $query_args ); |
|
| 23 | + $post_id = null; |
|
| 24 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 25 | + $post_id = get_the_ID(); |
|
| 26 | + endwhile; |
|
| 27 | 27 | |
| 28 | - $this->assertTrue(is_int($post_id)); |
|
| 28 | + $this->assertTrue(is_int($post_id)); |
|
| 29 | 29 | |
| 30 | - ob_start(); |
|
| 31 | - geodir_add_to_favorite($post_id); |
|
| 32 | - $output = ob_get_contents(); |
|
| 33 | - ob_end_clean(); |
|
| 34 | - $this->assertContains( 'Remove from Favorites', $output ); |
|
| 30 | + ob_start(); |
|
| 31 | + geodir_add_to_favorite($post_id); |
|
| 32 | + $output = ob_get_contents(); |
|
| 33 | + ob_end_clean(); |
|
| 34 | + $this->assertContains( 'Remove from Favorites', $output ); |
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | - $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
| 37 | + $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
| 38 | 38 | |
| 39 | - $this->assertContains( $post_id, $user_fav_posts ); |
|
| 39 | + $this->assertContains( $post_id, $user_fav_posts ); |
|
| 40 | 40 | |
| 41 | - ob_start(); |
|
| 42 | - geodir_user_show_favourites($user_id); |
|
| 43 | - $output = ob_get_contents(); |
|
| 44 | - ob_end_clean(); |
|
| 45 | - $this->assertContains( 'geodir_my_favourites', $output ); |
|
| 41 | + ob_start(); |
|
| 42 | + geodir_user_show_favourites($user_id); |
|
| 43 | + $output = ob_get_contents(); |
|
| 44 | + ob_end_clean(); |
|
| 45 | + $this->assertContains( 'geodir_my_favourites', $output ); |
|
| 46 | 46 | |
| 47 | - } |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - public function testDisplayUserListings() { |
|
| 49 | + public function testDisplayUserListings() { |
|
| 50 | 50 | |
| 51 | - global $current_user; |
|
| 51 | + global $current_user; |
|
| 52 | 52 | |
| 53 | - $user_id = $current_user->ID; |
|
| 53 | + $user_id = $current_user->ID; |
|
| 54 | 54 | |
| 55 | - ob_start(); |
|
| 56 | - geodir_user_show_listings($user_id); |
|
| 57 | - $output = ob_get_contents(); |
|
| 58 | - ob_end_clean(); |
|
| 59 | - $this->assertContains( 'geodir_my_listings', $output ); |
|
| 55 | + ob_start(); |
|
| 56 | + geodir_user_show_listings($user_id); |
|
| 57 | + $output = ob_get_contents(); |
|
| 58 | + ob_end_clean(); |
|
| 59 | + $this->assertContains( 'geodir_my_listings', $output ); |
|
| 60 | 60 | |
| 61 | - } |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - public function tearDown() |
|
| 64 | - { |
|
| 65 | - parent::tearDown(); |
|
| 66 | - } |
|
| 63 | + public function tearDown() |
|
| 64 | + { |
|
| 65 | + parent::tearDown(); |
|
| 66 | + } |
|
| 67 | 67 | } |
| 68 | 68 | ?> |
| 69 | 69 | \ No newline at end of file |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | 'posts_per_page' => 1, |
| 20 | 20 | ); |
| 21 | 21 | |
| 22 | - $all_posts = new WP_Query( $query_args ); |
|
| 22 | + $all_posts = new WP_Query($query_args); |
|
| 23 | 23 | $post_id = null; |
| 24 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 24 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
| 25 | 25 | $post_id = get_the_ID(); |
| 26 | 26 | endwhile; |
| 27 | 27 | |
@@ -31,18 +31,18 @@ discard block |
||
| 31 | 31 | geodir_add_to_favorite($post_id); |
| 32 | 32 | $output = ob_get_contents(); |
| 33 | 33 | ob_end_clean(); |
| 34 | - $this->assertContains( 'Remove from Favorites', $output ); |
|
| 34 | + $this->assertContains('Remove from Favorites', $output); |
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
| 38 | 38 | |
| 39 | - $this->assertContains( $post_id, $user_fav_posts ); |
|
| 39 | + $this->assertContains($post_id, $user_fav_posts); |
|
| 40 | 40 | |
| 41 | 41 | ob_start(); |
| 42 | 42 | geodir_user_show_favourites($user_id); |
| 43 | 43 | $output = ob_get_contents(); |
| 44 | 44 | ob_end_clean(); |
| 45 | - $this->assertContains( 'geodir_my_favourites', $output ); |
|
| 45 | + $this->assertContains('geodir_my_favourites', $output); |
|
| 46 | 46 | |
| 47 | 47 | } |
| 48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | geodir_user_show_listings($user_id); |
| 57 | 57 | $output = ob_get_contents(); |
| 58 | 58 | ob_end_clean(); |
| 59 | - $this->assertContains( 'geodir_my_listings', $output ); |
|
| 59 | + $this->assertContains('geodir_my_listings', $output); |
|
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | function drop_tables() { |
| 30 | 30 | global $wpdb, $plugin_prefix; |
| 31 | 31 | //build our query to delete our custom table |
| 32 | - $sql = "DROP TABLE IF EXISTS " . GEODIR_COUNTRIES_TABLE . ", " . GEODIR_ICON_TABLE . ", " . GEODIR_CUSTOM_FIELDS_TABLE . ", " . $plugin_prefix . "gd_place_detail, " . GEODIR_ATTACHMENT_TABLE . ", " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . ", " . GEODIR_REVIEW_TABLE . ";"; |
|
| 32 | + $sql = "DROP TABLE IF EXISTS ".GEODIR_COUNTRIES_TABLE.", ".GEODIR_ICON_TABLE.", ".GEODIR_CUSTOM_FIELDS_TABLE.", ".$plugin_prefix."gd_place_detail, ".GEODIR_ATTACHMENT_TABLE.", ".GEODIR_CUSTOM_SORT_FIELDS_TABLE.", ".GEODIR_REVIEW_TABLE.";"; |
|
| 33 | 33 | |
| 34 | 34 | //execute the query deleting the table |
| 35 | 35 | $wpdb->query($sql); |
@@ -1,89 +1,89 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class Favourites extends WP_UnitTestCase |
| 3 | 3 | { |
| 4 | - public function setUp() |
|
| 5 | - { |
|
| 6 | - parent::setUp(); |
|
| 7 | - wp_set_current_user(1); |
|
| 8 | - } |
|
| 4 | + public function setUp() |
|
| 5 | + { |
|
| 6 | + parent::setUp(); |
|
| 7 | + wp_set_current_user(1); |
|
| 8 | + } |
|
| 9 | 9 | |
| 10 | - public function testAddFavourite() |
|
| 11 | - { |
|
| 12 | - global $current_user; |
|
| 10 | + public function testAddFavourite() |
|
| 11 | + { |
|
| 12 | + global $current_user; |
|
| 13 | 13 | |
| 14 | - $user_id = $current_user->ID; |
|
| 14 | + $user_id = $current_user->ID; |
|
| 15 | 15 | |
| 16 | - $query_args = array( |
|
| 17 | - 'post_status' => 'publish', |
|
| 18 | - 'post_type' => 'gd_place', |
|
| 19 | - 'posts_per_page' => 1, |
|
| 20 | - ); |
|
| 16 | + $query_args = array( |
|
| 17 | + 'post_status' => 'publish', |
|
| 18 | + 'post_type' => 'gd_place', |
|
| 19 | + 'posts_per_page' => 1, |
|
| 20 | + ); |
|
| 21 | 21 | |
| 22 | - $all_posts = new WP_Query( $query_args ); |
|
| 23 | - $post_id = null; |
|
| 24 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 25 | - $post_id = get_the_ID(); |
|
| 26 | - endwhile; |
|
| 22 | + $all_posts = new WP_Query( $query_args ); |
|
| 23 | + $post_id = null; |
|
| 24 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 25 | + $post_id = get_the_ID(); |
|
| 26 | + endwhile; |
|
| 27 | 27 | |
| 28 | - $this->assertTrue(is_int($post_id)); |
|
| 28 | + $this->assertTrue(is_int($post_id)); |
|
| 29 | 29 | |
| 30 | - ob_start(); |
|
| 31 | - geodir_add_to_favorite($post_id); |
|
| 32 | - $output = ob_get_clean(); |
|
| 33 | - $this->assertContains( 'Remove from Favorites', $output ); |
|
| 30 | + ob_start(); |
|
| 31 | + geodir_add_to_favorite($post_id); |
|
| 32 | + $output = ob_get_clean(); |
|
| 33 | + $this->assertContains( 'Remove from Favorites', $output ); |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | - $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
| 36 | + $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
| 37 | 37 | |
| 38 | - $this->assertContains( $post_id, $user_fav_posts ); |
|
| 38 | + $this->assertContains( $post_id, $user_fav_posts ); |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - public function testRemoveFavourite() |
|
| 44 | - { |
|
| 45 | - global $current_user; |
|
| 43 | + public function testRemoveFavourite() |
|
| 44 | + { |
|
| 45 | + global $current_user; |
|
| 46 | 46 | |
| 47 | - $user_id = $current_user->ID; |
|
| 47 | + $user_id = $current_user->ID; |
|
| 48 | 48 | |
| 49 | - $query_args = array( |
|
| 50 | - 'post_status' => 'publish', |
|
| 51 | - 'post_type' => 'gd_place', |
|
| 52 | - 'posts_per_page' => 1, |
|
| 53 | - ); |
|
| 49 | + $query_args = array( |
|
| 50 | + 'post_status' => 'publish', |
|
| 51 | + 'post_type' => 'gd_place', |
|
| 52 | + 'posts_per_page' => 1, |
|
| 53 | + ); |
|
| 54 | 54 | |
| 55 | - $all_posts = new WP_Query( $query_args ); |
|
| 56 | - $post_id = null; |
|
| 57 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 58 | - $post_id = get_the_ID(); |
|
| 59 | - endwhile; |
|
| 55 | + $all_posts = new WP_Query( $query_args ); |
|
| 56 | + $post_id = null; |
|
| 57 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 58 | + $post_id = get_the_ID(); |
|
| 59 | + endwhile; |
|
| 60 | 60 | |
| 61 | - $this->assertTrue(is_int($post_id)); |
|
| 61 | + $this->assertTrue(is_int($post_id)); |
|
| 62 | 62 | |
| 63 | - ob_start(); |
|
| 64 | - geodir_add_to_favorite($post_id); |
|
| 65 | - $output = ob_get_clean(); |
|
| 66 | - $this->assertContains( 'Remove from Favorites', $output ); |
|
| 63 | + ob_start(); |
|
| 64 | + geodir_add_to_favorite($post_id); |
|
| 65 | + $output = ob_get_clean(); |
|
| 66 | + $this->assertContains( 'Remove from Favorites', $output ); |
|
| 67 | 67 | |
| 68 | 68 | |
| 69 | - $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
| 69 | + $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
| 70 | 70 | |
| 71 | - $this->assertContains( $post_id, $user_fav_posts ); |
|
| 71 | + $this->assertContains( $post_id, $user_fav_posts ); |
|
| 72 | 72 | |
| 73 | - ob_start(); |
|
| 74 | - geodir_remove_from_favorite($post_id); |
|
| 75 | - $output = ob_get_clean(); |
|
| 76 | - $this->assertContains( 'Add to Favorites', $output ); |
|
| 73 | + ob_start(); |
|
| 74 | + geodir_remove_from_favorite($post_id); |
|
| 75 | + $output = ob_get_clean(); |
|
| 76 | + $this->assertContains( 'Add to Favorites', $output ); |
|
| 77 | 77 | |
| 78 | - $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
| 78 | + $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
| 79 | 79 | |
| 80 | - $this->assertNotContains( $post_id, $user_fav_posts ); |
|
| 81 | - } |
|
| 80 | + $this->assertNotContains( $post_id, $user_fav_posts ); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | 83 | |
| 84 | - public function tearDown() |
|
| 85 | - { |
|
| 86 | - parent::tearDown(); |
|
| 87 | - } |
|
| 84 | + public function tearDown() |
|
| 85 | + { |
|
| 86 | + parent::tearDown(); |
|
| 87 | + } |
|
| 88 | 88 | } |
| 89 | 89 | ?> |
| 90 | 90 | \ No newline at end of file |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | 'posts_per_page' => 1, |
| 20 | 20 | ); |
| 21 | 21 | |
| 22 | - $all_posts = new WP_Query( $query_args ); |
|
| 22 | + $all_posts = new WP_Query($query_args); |
|
| 23 | 23 | $post_id = null; |
| 24 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 24 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
| 25 | 25 | $post_id = get_the_ID(); |
| 26 | 26 | endwhile; |
| 27 | 27 | |
@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | ob_start(); |
| 31 | 31 | geodir_add_to_favorite($post_id); |
| 32 | 32 | $output = ob_get_clean(); |
| 33 | - $this->assertContains( 'Remove from Favorites', $output ); |
|
| 33 | + $this->assertContains('Remove from Favorites', $output); |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
| 37 | 37 | |
| 38 | - $this->assertContains( $post_id, $user_fav_posts ); |
|
| 38 | + $this->assertContains($post_id, $user_fav_posts); |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | } |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | 'posts_per_page' => 1, |
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | - $all_posts = new WP_Query( $query_args ); |
|
| 55 | + $all_posts = new WP_Query($query_args); |
|
| 56 | 56 | $post_id = null; |
| 57 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 57 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
| 58 | 58 | $post_id = get_the_ID(); |
| 59 | 59 | endwhile; |
| 60 | 60 | |
@@ -63,21 +63,21 @@ discard block |
||
| 63 | 63 | ob_start(); |
| 64 | 64 | geodir_add_to_favorite($post_id); |
| 65 | 65 | $output = ob_get_clean(); |
| 66 | - $this->assertContains( 'Remove from Favorites', $output ); |
|
| 66 | + $this->assertContains('Remove from Favorites', $output); |
|
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
| 70 | 70 | |
| 71 | - $this->assertContains( $post_id, $user_fav_posts ); |
|
| 71 | + $this->assertContains($post_id, $user_fav_posts); |
|
| 72 | 72 | |
| 73 | 73 | ob_start(); |
| 74 | 74 | geodir_remove_from_favorite($post_id); |
| 75 | 75 | $output = ob_get_clean(); |
| 76 | - $this->assertContains( 'Add to Favorites', $output ); |
|
| 76 | + $this->assertContains('Add to Favorites', $output); |
|
| 77 | 77 | |
| 78 | 78 | $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
| 79 | 79 | |
| 80 | - $this->assertNotContains( $post_id, $user_fav_posts ); |
|
| 80 | + $this->assertNotContains($post_id, $user_fav_posts); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
@@ -167,8 +167,9 @@ discard block |
||
| 167 | 167 | $geodir_is_widget_listing = false; |
| 168 | 168 | |
| 169 | 169 | $GLOBALS['post'] = $current_post; |
| 170 | - if (!empty($current_post)) |
|
| 171 | - setup_postdata($current_post); |
|
| 170 | + if (!empty($current_post)) { |
|
| 171 | + setup_postdata($current_post); |
|
| 172 | + } |
|
| 172 | 173 | $map_jason = $current_map_jason; |
| 173 | 174 | $map_canvas_arr = $current_map_canvas_arr; |
| 174 | 175 | |
@@ -916,8 +917,10 @@ discard block |
||
| 916 | 917 | elseif ( is_date() && $template = get_date_template() ) : |
| 917 | 918 | elseif ( is_archive() && $template = get_archive_template() ) : |
| 918 | 919 | elseif ( is_paged() && $template = get_paged_template() ) : |
| 919 | - else : |
|
| 920 | + else { |
|
| 921 | + : |
|
| 920 | 922 | $template = get_index_template(); |
| 923 | + } |
|
| 921 | 924 | endif; |
| 922 | 925 | /** |
| 923 | 926 | * Filter the path of the current template before including it. |
@@ -16,15 +16,15 @@ discard block |
||
| 16 | 16 | 'posts_per_page' => 1, |
| 17 | 17 | ); |
| 18 | 18 | |
| 19 | - $all_posts = new WP_Query( $query_args ); |
|
| 19 | + $all_posts = new WP_Query($query_args); |
|
| 20 | 20 | $post_id = null; |
| 21 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 21 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
| 22 | 22 | $post_id = get_the_ID(); |
| 23 | 23 | endwhile; |
| 24 | 24 | |
| 25 | 25 | $this->assertTrue(is_int($post_id)); |
| 26 | 26 | |
| 27 | - $this->go_to( get_permalink($post_id) ); |
|
| 27 | + $this->go_to(get_permalink($post_id)); |
|
| 28 | 28 | |
| 29 | 29 | ob_start(); |
| 30 | 30 | geodir_breadcrumb(); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | // 'before_title' => '<ul>', |
| 120 | 120 | // 'after_title' => '<ul>' |
| 121 | 121 | // ); |
| 122 | - include_once geodir_plugin_path() . "/geodirectory-widgets/geodirectory_cpt_categories_widget.php"; |
|
| 122 | + include_once geodir_plugin_path()."/geodirectory-widgets/geodirectory_cpt_categories_widget.php"; |
|
| 123 | 123 | $params = array( |
| 124 | 124 | 'title' => '', |
| 125 | 125 | 'post_type' => array(), // NULL for all |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | public function testRegTemplate() { |
| 178 | 178 | // var_dump(geodir_login_page_id()); |
| 179 | 179 | wp_set_current_user(0); |
| 180 | - $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php'; |
|
| 180 | + $template = geodir_plugin_path().'/geodirectory-templates/geodir-signup.php'; |
|
| 181 | 181 | |
| 182 | 182 | ob_start(); |
| 183 | 183 | include($template); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | global $information; |
| 192 | 192 | $information = "hello world"; |
| 193 | 193 | |
| 194 | - $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; |
|
| 194 | + $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php'; |
|
| 195 | 195 | |
| 196 | 196 | ob_start(); |
| 197 | 197 | include($template); |
@@ -209,9 +209,9 @@ discard block |
||
| 209 | 209 | 'posts_per_page' => 1, |
| 210 | 210 | ); |
| 211 | 211 | |
| 212 | - $all_posts = new WP_Query( $query_args ); |
|
| 212 | + $all_posts = new WP_Query($query_args); |
|
| 213 | 213 | $post_id = null; |
| 214 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 214 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
| 215 | 215 | $post_id = get_the_ID(); |
| 216 | 216 | endwhile; |
| 217 | 217 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $_REQUEST['listing_type'] = 'gd_place'; |
| 221 | 221 | $_REQUEST['pid'] = $post_id; |
| 222 | 222 | ob_start(); |
| 223 | - $this->go_to( get_permalink(geodir_success_page_id()) ); |
|
| 223 | + $this->go_to(get_permalink(geodir_success_page_id())); |
|
| 224 | 224 | $this->load_template(); |
| 225 | 225 | $output = ob_get_contents(); |
| 226 | 226 | ob_end_clean(); |
@@ -236,9 +236,9 @@ discard block |
||
| 236 | 236 | 'posts_per_page' => 1, |
| 237 | 237 | ); |
| 238 | 238 | |
| 239 | - $all_posts = new WP_Query( $query_args ); |
|
| 239 | + $all_posts = new WP_Query($query_args); |
|
| 240 | 240 | $post_id = null; |
| 241 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 241 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
| 242 | 242 | $post_id = get_the_ID(); |
| 243 | 243 | endwhile; |
| 244 | 244 | |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | ); |
| 271 | 271 | |
| 272 | 272 | ob_start(); |
| 273 | - $this->go_to( get_permalink(geodir_preview_page_id()) ); |
|
| 273 | + $this->go_to(get_permalink(geodir_preview_page_id())); |
|
| 274 | 274 | $this->load_template(); |
| 275 | 275 | $output = ob_get_contents(); |
| 276 | 276 | ob_end_clean(); |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | wp_set_current_user(1); |
| 282 | 282 | |
| 283 | 283 | ob_start(); |
| 284 | - $this->go_to( get_permalink(geodir_add_listing_page_id()) ); |
|
| 284 | + $this->go_to(get_permalink(geodir_add_listing_page_id())); |
|
| 285 | 285 | $this->load_template(); |
| 286 | 286 | $output = ob_get_contents(); |
| 287 | 287 | ob_end_clean(); |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | wp_set_current_user(1); |
| 293 | 293 | |
| 294 | 294 | ob_start(); |
| 295 | - $this->go_to( get_permalink(geodir_location_page_id()) ); |
|
| 295 | + $this->go_to(get_permalink(geodir_location_page_id())); |
|
| 296 | 296 | $this->load_template(); |
| 297 | 297 | $output = ob_get_contents(); |
| 298 | 298 | ob_end_clean(); |
@@ -307,15 +307,15 @@ discard block |
||
| 307 | 307 | |
| 308 | 308 | $this->setPermalinkStructure(); |
| 309 | 309 | |
| 310 | - $homepage = get_page_by_title( 'GD Home page' ); |
|
| 311 | - if ( $homepage ) |
|
| 310 | + $homepage = get_page_by_title('GD Home page'); |
|
| 311 | + if ($homepage) |
|
| 312 | 312 | { |
| 313 | - update_option( 'page_on_front', $homepage->ID ); |
|
| 314 | - update_option( 'show_on_front', 'page' ); |
|
| 313 | + update_option('page_on_front', $homepage->ID); |
|
| 314 | + update_option('show_on_front', 'page'); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | ob_start(); |
| 318 | - $this->go_to( home_url('/') ); |
|
| 318 | + $this->go_to(home_url('/')); |
|
| 319 | 319 | $this->load_template(); |
| 320 | 320 | $output = ob_get_contents(); |
| 321 | 321 | ob_end_clean(); |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | |
| 324 | 324 | |
| 325 | 325 | ob_start(); |
| 326 | - $this->go_to( home_url('/?post_type=gd_place') ); |
|
| 326 | + $this->go_to(home_url('/?post_type=gd_place')); |
|
| 327 | 327 | $this->load_template(); |
| 328 | 328 | $output = ob_get_contents(); |
| 329 | 329 | ob_end_clean(); |
@@ -335,9 +335,9 @@ discard block |
||
| 335 | 335 | 'posts_per_page' => 1, |
| 336 | 336 | ); |
| 337 | 337 | |
| 338 | - $all_posts = new WP_Query( $query_args ); |
|
| 338 | + $all_posts = new WP_Query($query_args); |
|
| 339 | 339 | $post_id = null; |
| 340 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 340 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
| 341 | 341 | $post_id = get_the_ID(); |
| 342 | 342 | endwhile; |
| 343 | 343 | |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | global $preview; |
| 347 | 347 | $preview = false; |
| 348 | 348 | ob_start(); |
| 349 | - $this->go_to( get_permalink($post_id) ); |
|
| 349 | + $this->go_to(get_permalink($post_id)); |
|
| 350 | 350 | $this->load_template(); |
| 351 | 351 | $output = ob_get_contents(); |
| 352 | 352 | ob_end_clean(); |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | ob_start(); |
| 356 | 356 | $_REQUEST['stype'] = 'gd_place'; |
| 357 | 357 | $_REQUEST['geodir_dashbord'] = true; |
| 358 | - $this->go_to( get_author_posts_url($user_id) ); |
|
| 358 | + $this->go_to(get_author_posts_url($user_id)); |
|
| 359 | 359 | $this->load_template(); |
| 360 | 360 | $output = ob_get_contents(); |
| 361 | 361 | ob_end_clean(); |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | ob_start(); |
| 368 | 368 | $_REQUEST['geodir_search'] = "1"; |
| 369 | 369 | $_REQUEST['stype'] = 'gd_place'; |
| 370 | - $this->go_to( home_url('/?geodir_search=1&stype=gd_place&s=test&snear=&sgeo_lat=&sgeo_lon=') ); |
|
| 370 | + $this->go_to(home_url('/?geodir_search=1&stype=gd_place&s=test&snear=&sgeo_lat=&sgeo_lon=')); |
|
| 371 | 371 | $this->load_template(); |
| 372 | 372 | $output = ob_get_contents(); |
| 373 | 373 | ob_end_clean(); |
@@ -383,9 +383,9 @@ discard block |
||
| 383 | 383 | 'posts_per_page' => 1, |
| 384 | 384 | ); |
| 385 | 385 | |
| 386 | - $all_posts = new WP_Query( $query_args ); |
|
| 386 | + $all_posts = new WP_Query($query_args); |
|
| 387 | 387 | $post_id = null; |
| 388 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 388 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
| 389 | 389 | $post_id = get_the_ID(); |
| 390 | 390 | endwhile; |
| 391 | 391 | |
@@ -413,9 +413,9 @@ discard block |
||
| 413 | 413 | 'posts_per_page' => 1, |
| 414 | 414 | ); |
| 415 | 415 | |
| 416 | - $all_posts = new WP_Query( $query_args ); |
|
| 416 | + $all_posts = new WP_Query($query_args); |
|
| 417 | 417 | $post_id = null; |
| 418 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 418 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
| 419 | 419 | $post_id = get_the_ID(); |
| 420 | 420 | endwhile; |
| 421 | 421 | |
@@ -436,23 +436,23 @@ discard block |
||
| 436 | 436 | $menuname = 'Primary Menu'; |
| 437 | 437 | $menulocation = 'primary'; |
| 438 | 438 | // Does the menu exist already? |
| 439 | - $menu_exists = wp_get_nav_menu_object( $menuname ); |
|
| 439 | + $menu_exists = wp_get_nav_menu_object($menuname); |
|
| 440 | 440 | |
| 441 | 441 | // If it doesn't exist, let's create it. |
| 442 | - if( !$menu_exists){ |
|
| 442 | + if (!$menu_exists) { |
|
| 443 | 443 | $menu_id = wp_create_nav_menu($menuname); |
| 444 | 444 | |
| 445 | 445 | // Set up default BuddyPress links and add them to the menu. |
| 446 | 446 | wp_update_nav_menu_item($menu_id, 0, array( |
| 447 | 447 | 'menu-item-title' => __('Home'), |
| 448 | 448 | 'menu-item-classes' => 'home', |
| 449 | - 'menu-item-url' => home_url( '/' ), |
|
| 449 | + 'menu-item-url' => home_url('/'), |
|
| 450 | 450 | 'menu-item-status' => 'publish')); |
| 451 | 451 | |
| 452 | - if( !has_nav_menu( $menulocation ) ){ |
|
| 452 | + if (!has_nav_menu($menulocation)) { |
|
| 453 | 453 | $locations = get_theme_mod('nav_menu_locations'); |
| 454 | 454 | $locations[$menulocation] = $menu_id; |
| 455 | - set_theme_mod( 'nav_menu_locations', $locations ); |
|
| 455 | + set_theme_mod('nav_menu_locations', $locations); |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | update_option('geodir_theme_location_nav', array('primary')); |
@@ -469,20 +469,20 @@ discard block |
||
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | public function testBestOfWidget() { |
| 472 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
| 472 | + $template = geodir_plugin_path().'/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
| 473 | 473 | include_once($template); |
| 474 | 474 | |
| 475 | 475 | ob_start(); |
| 476 | 476 | $instance = array(); |
| 477 | 477 | $instance['use_viewing_post_type'] = '1'; |
| 478 | 478 | $instance['excerpt_type'] = 'show-reviews'; |
| 479 | - the_widget( 'geodir_bestof_widget' ); |
|
| 479 | + the_widget('geodir_bestof_widget'); |
|
| 480 | 480 | $output = ob_get_contents(); |
| 481 | 481 | ob_end_clean(); |
| 482 | 482 | $this->assertContains('bestof-widget-tab-layout', $output); |
| 483 | 483 | |
| 484 | 484 | ob_start(); |
| 485 | - $this->the_widget_form( 'geodir_bestof_widget' ); |
|
| 485 | + $this->the_widget_form('geodir_bestof_widget'); |
|
| 486 | 486 | $output = ob_get_contents(); |
| 487 | 487 | ob_end_clean(); |
| 488 | 488 | $this->assertContains('Number of categories', $output); |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | 'excerpt_type' => 'show-desc', |
| 499 | 499 | 'use_viewing_post_type' => '1' |
| 500 | 500 | ); |
| 501 | - $output = $this->the_widget_form_update( 'geodir_bestof_widget', $new_instance ); |
|
| 501 | + $output = $this->the_widget_form_update('geodir_bestof_widget', $new_instance); |
|
| 502 | 502 | $this->assertContains('20', $output['character_count']); |
| 503 | 503 | |
| 504 | 504 | ob_start(); |
@@ -510,17 +510,17 @@ discard block |
||
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | public function testCptCatsWidget() { |
| 513 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_cpt_categories_widget.php'; |
|
| 513 | + $template = geodir_plugin_path().'/geodirectory-widgets/geodirectory_cpt_categories_widget.php'; |
|
| 514 | 514 | include_once($template); |
| 515 | 515 | |
| 516 | 516 | ob_start(); |
| 517 | - the_widget( 'geodir_cpt_categories_widget' ); |
|
| 517 | + the_widget('geodir_cpt_categories_widget'); |
|
| 518 | 518 | $output = ob_get_contents(); |
| 519 | 519 | ob_end_clean(); |
| 520 | 520 | $this->assertContains('geodir_cpt_categories_widget', $output); |
| 521 | 521 | |
| 522 | 522 | ob_start(); |
| 523 | - $this->the_widget_form( 'geodir_cpt_categories_widget' ); |
|
| 523 | + $this->the_widget_form('geodir_cpt_categories_widget'); |
|
| 524 | 524 | $output = ob_get_contents(); |
| 525 | 525 | ob_end_clean(); |
| 526 | 526 | $this->assertContains('Select CPT', $output); |
@@ -536,13 +536,13 @@ discard block |
||
| 536 | 536 | 'max_count' => 'all', |
| 537 | 537 | 'max_level' => '1' |
| 538 | 538 | ); |
| 539 | - $output = $this->the_widget_form_update( 'geodir_cpt_categories_widget', $new_instance ); |
|
| 539 | + $output = $this->the_widget_form_update('geodir_cpt_categories_widget', $new_instance); |
|
| 540 | 540 | $this->assertContains('count', $output['sort_by']); |
| 541 | 541 | |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | public function testFeaturesWidget() { |
| 545 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_features_widget.php'; |
|
| 545 | + $template = geodir_plugin_path().'/geodirectory-widgets/geodirectory_features_widget.php'; |
|
| 546 | 546 | include_once($template); |
| 547 | 547 | |
| 548 | 548 | $instance = array( |
@@ -554,13 +554,13 @@ discard block |
||
| 554 | 554 | ); |
| 555 | 555 | |
| 556 | 556 | ob_start(); |
| 557 | - the_widget( 'Geodir_Features_Widget', $instance); |
|
| 557 | + the_widget('Geodir_Features_Widget', $instance); |
|
| 558 | 558 | $output = ob_get_contents(); |
| 559 | 559 | ob_end_clean(); |
| 560 | 560 | $this->assertContains('widget_gd_features', $output); |
| 561 | 561 | |
| 562 | 562 | ob_start(); |
| 563 | - $this->the_widget_form( 'Geodir_Features_Widget', $instance ); |
|
| 563 | + $this->the_widget_form('Geodir_Features_Widget', $instance); |
|
| 564 | 564 | $output = ob_get_contents(); |
| 565 | 565 | ob_end_clean(); |
| 566 | 566 | $this->assertContains('Font Awesome Icon Color', $output); |
@@ -572,23 +572,23 @@ discard block |
||
| 572 | 572 | 'image1' => 'fa-recycle', |
| 573 | 573 | 'desc1' => 'cool', |
| 574 | 574 | ); |
| 575 | - $output = $this->the_widget_form_update( 'Geodir_Features_Widget', $new_instance ); |
|
| 575 | + $output = $this->the_widget_form_update('Geodir_Features_Widget', $new_instance); |
|
| 576 | 576 | $this->assertContains('Features', $output['title']); |
| 577 | 577 | |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | public function testSliderWidget() { |
| 581 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_listing_slider_widget.php'; |
|
| 581 | + $template = geodir_plugin_path().'/geodirectory-widgets/geodirectory_listing_slider_widget.php'; |
|
| 582 | 582 | include_once($template); |
| 583 | 583 | |
| 584 | 584 | ob_start(); |
| 585 | - the_widget( 'geodir_listing_slider_widget' ); |
|
| 585 | + the_widget('geodir_listing_slider_widget'); |
|
| 586 | 586 | $output = ob_get_contents(); |
| 587 | 587 | ob_end_clean(); |
| 588 | 588 | $this->assertContains('geodir_listing_slider_view', $output); |
| 589 | 589 | |
| 590 | 590 | ob_start(); |
| 591 | - $this->the_widget_form( 'geodir_listing_slider_widget' ); |
|
| 591 | + $this->the_widget_form('geodir_listing_slider_widget'); |
|
| 592 | 592 | $output = ob_get_contents(); |
| 593 | 593 | ob_end_clean(); |
| 594 | 594 | $this->assertContains('Slide Show Speed', $output); |
@@ -610,23 +610,23 @@ discard block |
||
| 610 | 610 | 'list_sort' => 'latest', |
| 611 | 611 | 'show_featured_only' => '', |
| 612 | 612 | ); |
| 613 | - $output = $this->the_widget_form_update( 'geodir_listing_slider_widget', $new_instance ); |
|
| 613 | + $output = $this->the_widget_form_update('geodir_listing_slider_widget', $new_instance); |
|
| 614 | 614 | $this->assertContains('latest', $output['list_sort']); |
| 615 | 615 | |
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | public function testPopularWidget() { |
| 619 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_popular_widget.php'; |
|
| 619 | + $template = geodir_plugin_path().'/geodirectory-widgets/geodirectory_popular_widget.php'; |
|
| 620 | 620 | include_once($template); |
| 621 | 621 | |
| 622 | 622 | ob_start(); |
| 623 | - the_widget( 'geodir_popular_post_category' ); |
|
| 623 | + the_widget('geodir_popular_post_category'); |
|
| 624 | 624 | $output = ob_get_contents(); |
| 625 | 625 | ob_end_clean(); |
| 626 | 626 | $this->assertContains('geodir_popular_post_category', $output); |
| 627 | 627 | |
| 628 | 628 | ob_start(); |
| 629 | - $this->the_widget_form( 'geodir_popular_post_category' ); |
|
| 629 | + $this->the_widget_form('geodir_popular_post_category'); |
|
| 630 | 630 | $output = ob_get_contents(); |
| 631 | 631 | ob_end_clean(); |
| 632 | 632 | $this->assertContains('Default post type to use', $output); |
@@ -636,19 +636,19 @@ discard block |
||
| 636 | 636 | 'category_limit' => 15, |
| 637 | 637 | 'default_post_type' => '' |
| 638 | 638 | ); |
| 639 | - $output = $this->the_widget_form_update( 'geodir_popular_post_category', $new_instance ); |
|
| 639 | + $output = $this->the_widget_form_update('geodir_popular_post_category', $new_instance); |
|
| 640 | 640 | $this->assertEquals(15, $output['category_limit']); |
| 641 | 641 | |
| 642 | 642 | ob_start(); |
| 643 | 643 | $instance = array(); |
| 644 | 644 | $instance['category_title'] = ''; |
| 645 | - the_widget( 'geodir_popular_postview', $instance ); |
|
| 645 | + the_widget('geodir_popular_postview', $instance); |
|
| 646 | 646 | $output = ob_get_contents(); |
| 647 | 647 | ob_end_clean(); |
| 648 | 648 | $this->assertContains('geodir_popular_post_view', $output); |
| 649 | 649 | |
| 650 | 650 | ob_start(); |
| 651 | - $this->the_widget_form( 'geodir_popular_postview' ); |
|
| 651 | + $this->the_widget_form('geodir_popular_postview'); |
|
| 652 | 652 | $output = ob_get_contents(); |
| 653 | 653 | ob_end_clean(); |
| 654 | 654 | $this->assertContains('Post Category', $output); |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | 'with_videos_only' => '', |
| 672 | 672 | 'use_viewing_post_type' => '' |
| 673 | 673 | ); |
| 674 | - $output = $this->the_widget_form_update( 'geodir_popular_postview', $new_instance ); |
|
| 674 | + $output = $this->the_widget_form_update('geodir_popular_postview', $new_instance); |
|
| 675 | 675 | $this->assertContains('gridview_onehalf', $output['layout']); |
| 676 | 676 | |
| 677 | 677 | } |
@@ -683,9 +683,9 @@ discard block |
||
| 683 | 683 | 'posts_per_page' => 1, |
| 684 | 684 | ); |
| 685 | 685 | |
| 686 | - $all_posts = new WP_Query( $query_args ); |
|
| 686 | + $all_posts = new WP_Query($query_args); |
|
| 687 | 687 | $post_id = null; |
| 688 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 688 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
| 689 | 689 | global $post; |
| 690 | 690 | $post_id = get_the_ID(); |
| 691 | 691 | $post = geodir_get_post_info($post->ID); |
@@ -693,17 +693,17 @@ discard block |
||
| 693 | 693 | // $term_list = wp_get_post_terms($post->ID, 'gd_placecategory'); |
| 694 | 694 | // $post->gd_placecategory = (string) $term_list[0]->term_id; |
| 695 | 695 | |
| 696 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_related_listing_widget.php'; |
|
| 696 | + $template = geodir_plugin_path().'/geodirectory-widgets/geodirectory_related_listing_widget.php'; |
|
| 697 | 697 | include_once($template); |
| 698 | 698 | |
| 699 | 699 | ob_start(); |
| 700 | - the_widget( 'geodir_related_listing_postview' ); |
|
| 700 | + the_widget('geodir_related_listing_postview'); |
|
| 701 | 701 | $output = ob_get_contents(); |
| 702 | 702 | ob_end_clean(); |
| 703 | 703 | $this->assertContains('Related Listing', $output); |
| 704 | 704 | |
| 705 | 705 | ob_start(); |
| 706 | - $this->the_widget_form( 'geodir_related_listing_postview' ); |
|
| 706 | + $this->the_widget_form('geodir_related_listing_postview'); |
|
| 707 | 707 | $output = ob_get_contents(); |
| 708 | 708 | ob_end_clean(); |
| 709 | 709 | $this->assertContains('Relate to', $output); |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | 'add_location_filter' => '1', |
| 720 | 720 | 'character_count' => '20' |
| 721 | 721 | ); |
| 722 | - $output = $this->the_widget_form_update( 'geodir_related_listing_postview', $new_instance ); |
|
| 722 | + $output = $this->the_widget_form_update('geodir_related_listing_postview', $new_instance); |
|
| 723 | 723 | $this->assertContains('gridview_onehalf', $output['layout']); |
| 724 | 724 | endwhile; |
| 725 | 725 | |
@@ -775,17 +775,17 @@ discard block |
||
| 775 | 775 | |
| 776 | 776 | $this->assertTrue(is_int($comment_id)); |
| 777 | 777 | |
| 778 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_reviews_widget.php'; |
|
| 778 | + $template = geodir_plugin_path().'/geodirectory-widgets/geodirectory_reviews_widget.php'; |
|
| 779 | 779 | include_once($template); |
| 780 | 780 | |
| 781 | 781 | ob_start(); |
| 782 | - the_widget( 'geodir_recent_reviews_widget' ); |
|
| 782 | + the_widget('geodir_recent_reviews_widget'); |
|
| 783 | 783 | $output = ob_get_contents(); |
| 784 | 784 | ob_end_clean(); |
| 785 | 785 | $this->assertContains('geodir_recent_reviews', $output); |
| 786 | 786 | |
| 787 | 787 | ob_start(); |
| 788 | - $this->the_widget_form( 'geodir_recent_reviews_widget' ); |
|
| 788 | + $this->the_widget_form('geodir_recent_reviews_widget'); |
|
| 789 | 789 | $output = ob_get_contents(); |
| 790 | 790 | ob_end_clean(); |
| 791 | 791 | $this->assertContains('Number of Reviews', $output); |
@@ -798,25 +798,25 @@ discard block |
||
| 798 | 798 | 'img1' => '', |
| 799 | 799 | 'count' => '' |
| 800 | 800 | ); |
| 801 | - $output = $this->the_widget_form_update( 'geodir_recent_reviews_widget', $new_instance ); |
|
| 801 | + $output = $this->the_widget_form_update('geodir_recent_reviews_widget', $new_instance); |
|
| 802 | 802 | $this->assertTrue(empty($output['count'])); |
| 803 | 803 | } |
| 804 | 804 | |
| 805 | 805 | public function testHomeMapWidget() { |
| 806 | - $template = geodir_plugin_path() . '/geodirectory-widgets/home_map_widget.php'; |
|
| 806 | + $template = geodir_plugin_path().'/geodirectory-widgets/home_map_widget.php'; |
|
| 807 | 807 | include_once($template); |
| 808 | 808 | |
| 809 | 809 | ob_start(); |
| 810 | 810 | $instance = array(); |
| 811 | 811 | $args = array(); |
| 812 | 812 | $args["widget_id"] = "geodir_map_v3_home_map-2"; |
| 813 | - the_widget( 'geodir_homepage_map', $instance, $args ); |
|
| 813 | + the_widget('geodir_homepage_map', $instance, $args); |
|
| 814 | 814 | $output = ob_get_contents(); |
| 815 | 815 | ob_end_clean(); |
| 816 | 816 | $this->assertContains('geodir-map-home-page', $output); |
| 817 | 817 | |
| 818 | 818 | ob_start(); |
| 819 | - $this->the_widget_form( 'geodir_homepage_map' ); |
|
| 819 | + $this->the_widget_form('geodir_homepage_map'); |
|
| 820 | 820 | $output = ob_get_contents(); |
| 821 | 821 | ob_end_clean(); |
| 822 | 822 | $this->assertContains('Map Zoom level', $output); |
@@ -830,7 +830,7 @@ discard block |
||
| 830 | 830 | 'child_collapse' => '0', |
| 831 | 831 | 'scrollwheel' => '0' |
| 832 | 832 | ); |
| 833 | - $output = $this->the_widget_form_update( 'geodir_homepage_map', $new_instance ); |
|
| 833 | + $output = $this->the_widget_form_update('geodir_homepage_map', $new_instance); |
|
| 834 | 834 | $this->assertContains('0', $output['scrollwheel']); |
| 835 | 835 | |
| 836 | 836 | } |
@@ -840,13 +840,13 @@ discard block |
||
| 840 | 840 | register_geodir_widgets(); |
| 841 | 841 | |
| 842 | 842 | ob_start(); |
| 843 | - the_widget( 'geodir_loginwidget' ); |
|
| 843 | + the_widget('geodir_loginwidget'); |
|
| 844 | 844 | $output = ob_get_contents(); |
| 845 | 845 | ob_end_clean(); |
| 846 | 846 | $this->assertContains('geodir_loginbox', $output); |
| 847 | 847 | |
| 848 | 848 | ob_start(); |
| 849 | - $this->the_widget_form( 'geodir_loginwidget' ); |
|
| 849 | + $this->the_widget_form('geodir_loginwidget'); |
|
| 850 | 850 | $output = ob_get_contents(); |
| 851 | 851 | ob_end_clean(); |
| 852 | 852 | $this->assertContains('Widget Title', $output); |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | 'img1' => '', |
| 860 | 860 | 'desc1' => '' |
| 861 | 861 | ); |
| 862 | - $output = $this->the_widget_form_update( 'geodir_loginwidget', $new_instance ); |
|
| 862 | + $output = $this->the_widget_form_update('geodir_loginwidget', $new_instance); |
|
| 863 | 863 | $this->assertContains('Login', $output['title']); |
| 864 | 864 | |
| 865 | 865 | } |
@@ -867,13 +867,13 @@ discard block |
||
| 867 | 867 | public function testSocialWidget() { |
| 868 | 868 | |
| 869 | 869 | ob_start(); |
| 870 | - the_widget( 'geodir_social_like_widget' ); |
|
| 870 | + the_widget('geodir_social_like_widget'); |
|
| 871 | 871 | $output = ob_get_contents(); |
| 872 | 872 | ob_end_clean(); |
| 873 | 873 | $this->assertContains('twitter.com', $output); |
| 874 | 874 | |
| 875 | 875 | ob_start(); |
| 876 | - $this->the_widget_form( 'geodir_social_like_widget' ); |
|
| 876 | + $this->the_widget_form('geodir_social_like_widget'); |
|
| 877 | 877 | $output = ob_get_contents(); |
| 878 | 878 | ob_end_clean(); |
| 879 | 879 | $this->assertContains('No settings for this widget', $output); |
@@ -881,7 +881,7 @@ discard block |
||
| 881 | 881 | $new_instance = array( |
| 882 | 882 | 'title' => 'Social', |
| 883 | 883 | ); |
| 884 | - $output = $this->the_widget_form_update( 'geodir_social_like_widget', $new_instance ); |
|
| 884 | + $output = $this->the_widget_form_update('geodir_social_like_widget', $new_instance); |
|
| 885 | 885 | $this->assertContains('Social', $output['title']); |
| 886 | 886 | |
| 887 | 887 | } |
@@ -889,13 +889,13 @@ discard block |
||
| 889 | 889 | public function testSubscribeWidget() { |
| 890 | 890 | |
| 891 | 891 | ob_start(); |
| 892 | - the_widget( 'geodirsubscribeWidget' ); |
|
| 892 | + the_widget('geodirsubscribeWidget'); |
|
| 893 | 893 | $output = ob_get_contents(); |
| 894 | 894 | ob_end_clean(); |
| 895 | 895 | $this->assertContains('geodir-subscribe-form', $output); |
| 896 | 896 | |
| 897 | 897 | ob_start(); |
| 898 | - $this->the_widget_form( 'geodirsubscribeWidget' ); |
|
| 898 | + $this->the_widget_form('geodirsubscribeWidget'); |
|
| 899 | 899 | $output = ob_get_contents(); |
| 900 | 900 | ob_end_clean(); |
| 901 | 901 | $this->assertContains('Feedburner ID', $output); |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | 'digg' => '', |
| 911 | 911 | 'myspace' => '' |
| 912 | 912 | ); |
| 913 | - $output = $this->the_widget_form_update( 'geodirsubscribeWidget', $new_instance ); |
|
| 913 | + $output = $this->the_widget_form_update('geodirsubscribeWidget', $new_instance); |
|
| 914 | 914 | $this->assertContains('Subscribe', $output['title']); |
| 915 | 915 | |
| 916 | 916 | } |
@@ -920,13 +920,13 @@ discard block |
||
| 920 | 920 | ob_start(); |
| 921 | 921 | $instance = array(); |
| 922 | 922 | $instance['desc1'] = 'hello'; |
| 923 | - the_widget( 'geodiradvtwidget', $instance ); |
|
| 923 | + the_widget('geodiradvtwidget', $instance); |
|
| 924 | 924 | $output = ob_get_contents(); |
| 925 | 925 | ob_end_clean(); |
| 926 | 926 | $this->assertContains('hello', $output); |
| 927 | 927 | |
| 928 | 928 | ob_start(); |
| 929 | - $this->the_widget_form( 'geodiradvtwidget' ); |
|
| 929 | + $this->the_widget_form('geodiradvtwidget'); |
|
| 930 | 930 | $output = ob_get_contents(); |
| 931 | 931 | ob_end_clean(); |
| 932 | 932 | $this->assertContains('Your Advt code', $output); |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | $new_instance = array( |
| 935 | 935 | 'desc1' => 'Advertise' |
| 936 | 936 | ); |
| 937 | - $output = $this->the_widget_form_update( 'geodiradvtwidget', $new_instance ); |
|
| 937 | + $output = $this->the_widget_form_update('geodiradvtwidget', $new_instance); |
|
| 938 | 938 | $this->assertContains('Advertise', $output['desc1']); |
| 939 | 939 | |
| 940 | 940 | } |
@@ -942,13 +942,13 @@ discard block |
||
| 942 | 942 | public function testFlickrWidget() { |
| 943 | 943 | |
| 944 | 944 | ob_start(); |
| 945 | - the_widget( 'GeodirFlickrWidget' ); |
|
| 945 | + the_widget('GeodirFlickrWidget'); |
|
| 946 | 946 | $output = ob_get_contents(); |
| 947 | 947 | ob_end_clean(); |
| 948 | 948 | $this->assertContains('geodir-flickr', $output); |
| 949 | 949 | |
| 950 | 950 | ob_start(); |
| 951 | - $this->the_widget_form( 'GeodirFlickrWidget' ); |
|
| 951 | + $this->the_widget_form('GeodirFlickrWidget'); |
|
| 952 | 952 | $output = ob_get_contents(); |
| 953 | 953 | ob_end_clean(); |
| 954 | 954 | $this->assertContains('Flickr ID', $output); |
@@ -957,7 +957,7 @@ discard block |
||
| 957 | 957 | 'id' => '', |
| 958 | 958 | 'number' => '34' |
| 959 | 959 | ); |
| 960 | - $output = $this->the_widget_form_update( 'GeodirFlickrWidget', $new_instance ); |
|
| 960 | + $output = $this->the_widget_form_update('GeodirFlickrWidget', $new_instance); |
|
| 961 | 961 | $this->assertContains('34', $output['number']); |
| 962 | 962 | |
| 963 | 963 | } |
@@ -967,13 +967,13 @@ discard block |
||
| 967 | 967 | ob_start(); |
| 968 | 968 | $instance = array(); |
| 969 | 969 | $instance['gd_tw_desc1'] = 'hello'; |
| 970 | - the_widget( 'geodir_twitter', $instance ); |
|
| 970 | + the_widget('geodir_twitter', $instance); |
|
| 971 | 971 | $output = ob_get_contents(); |
| 972 | 972 | ob_end_clean(); |
| 973 | 973 | $this->assertContains('hello', $output); |
| 974 | 974 | |
| 975 | 975 | ob_start(); |
| 976 | - $this->the_widget_form( 'geodir_twitter' ); |
|
| 976 | + $this->the_widget_form('geodir_twitter'); |
|
| 977 | 977 | $output = ob_get_contents(); |
| 978 | 978 | ob_end_clean(); |
| 979 | 979 | $this->assertContains('Your twitter code', $output); |
@@ -981,7 +981,7 @@ discard block |
||
| 981 | 981 | $new_instance = array( |
| 982 | 982 | 'gd_tw_desc1' => 'hello' |
| 983 | 983 | ); |
| 984 | - $output = $this->the_widget_form_update( 'geodir_twitter', $new_instance ); |
|
| 984 | + $output = $this->the_widget_form_update('geodir_twitter', $new_instance); |
|
| 985 | 985 | $this->assertContains('hello', $output['gd_tw_desc1']); |
| 986 | 986 | |
| 987 | 987 | } |
@@ -989,13 +989,13 @@ discard block |
||
| 989 | 989 | public function testAdvSearchWidget() { |
| 990 | 990 | |
| 991 | 991 | ob_start(); |
| 992 | - the_widget( 'geodir_advance_search_widget' ); |
|
| 992 | + the_widget('geodir_advance_search_widget'); |
|
| 993 | 993 | $output = ob_get_contents(); |
| 994 | 994 | ob_end_clean(); |
| 995 | 995 | $this->assertContains('geodir-loc-bar', $output); |
| 996 | 996 | |
| 997 | 997 | ob_start(); |
| 998 | - $this->the_widget_form( 'geodir_advance_search_widget' ); |
|
| 998 | + $this->the_widget_form('geodir_advance_search_widget'); |
|
| 999 | 999 | $output = ob_get_contents(); |
| 1000 | 1000 | ob_end_clean(); |
| 1001 | 1001 | $this->assertContains('This is a search widget', $output); |
@@ -1009,17 +1009,17 @@ discard block |
||
| 1009 | 1009 | |
| 1010 | 1010 | public function testListingMapWidget() { |
| 1011 | 1011 | |
| 1012 | - $template = geodir_plugin_path() . '/geodirectory-widgets/listing_map_widget.php'; |
|
| 1012 | + $template = geodir_plugin_path().'/geodirectory-widgets/listing_map_widget.php'; |
|
| 1013 | 1013 | include_once($template); |
| 1014 | 1014 | |
| 1015 | 1015 | //listing page |
| 1016 | - $this->go_to( home_url('/?post_type=gd_place') ); |
|
| 1016 | + $this->go_to(home_url('/?post_type=gd_place')); |
|
| 1017 | 1017 | |
| 1018 | 1018 | ob_start(); |
| 1019 | 1019 | $instance = array(); |
| 1020 | 1020 | $args = array(); |
| 1021 | 1021 | $args["widget_id"] = "geodir_map_v3_listing_map-2"; |
| 1022 | - the_widget( 'geodir_map_listingpage', $instance, $args ); |
|
| 1022 | + the_widget('geodir_map_listingpage', $instance, $args); |
|
| 1023 | 1023 | $output = ob_get_contents(); |
| 1024 | 1024 | ob_end_clean(); |
| 1025 | 1025 | $this->assertContains('geodir-map-listing-page', $output); |
@@ -1031,27 +1031,27 @@ discard block |
||
| 1031 | 1031 | 'posts_per_page' => 1, |
| 1032 | 1032 | ); |
| 1033 | 1033 | |
| 1034 | - $all_posts = new WP_Query( $query_args ); |
|
| 1034 | + $all_posts = new WP_Query($query_args); |
|
| 1035 | 1035 | $post_id = null; |
| 1036 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 1036 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
| 1037 | 1037 | $post_id = get_the_ID(); |
| 1038 | 1038 | endwhile; |
| 1039 | 1039 | |
| 1040 | 1040 | $this->assertTrue(is_int($post_id)); |
| 1041 | 1041 | |
| 1042 | - $this->go_to( get_permalink($post_id) ); |
|
| 1042 | + $this->go_to(get_permalink($post_id)); |
|
| 1043 | 1043 | |
| 1044 | 1044 | ob_start(); |
| 1045 | 1045 | $instance = array(); |
| 1046 | 1046 | $args = array(); |
| 1047 | 1047 | $args["widget_id"] = "geodir_map_v3_listing_map-2"; |
| 1048 | - the_widget( 'geodir_map_listingpage', $instance, $args ); |
|
| 1048 | + the_widget('geodir_map_listingpage', $instance, $args); |
|
| 1049 | 1049 | $output = ob_get_contents(); |
| 1050 | 1050 | ob_end_clean(); |
| 1051 | 1051 | $this->assertContains('geodir-map-listing-page', $output); |
| 1052 | 1052 | |
| 1053 | 1053 | ob_start(); |
| 1054 | - $this->the_widget_form( 'geodir_map_listingpage' ); |
|
| 1054 | + $this->the_widget_form('geodir_map_listingpage'); |
|
| 1055 | 1055 | $output = ob_get_contents(); |
| 1056 | 1056 | ob_end_clean(); |
| 1057 | 1057 | $this->assertContains('Select Map View', $output); |
@@ -1066,31 +1066,31 @@ discard block |
||
| 1066 | 1066 | 'scrollwheel' => '0', |
| 1067 | 1067 | 'showall' => '0' |
| 1068 | 1068 | ); |
| 1069 | - $output = $this->the_widget_form_update( 'geodir_map_listingpage', $new_instance ); |
|
| 1069 | + $output = $this->the_widget_form_update('geodir_map_listingpage', $new_instance); |
|
| 1070 | 1070 | $this->assertContains('0', $output['scrollwheel']); |
| 1071 | 1071 | |
| 1072 | 1072 | |
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | private function load_template() { |
| 1076 | - do_action( 'template_redirect' ); |
|
| 1076 | + do_action('template_redirect'); |
|
| 1077 | 1077 | $template = false; |
| 1078 | - if ( is_404() && $template = get_404_template() ) : |
|
| 1079 | - elseif ( is_search() && $template = get_search_template() ) : |
|
| 1080 | - elseif ( is_front_page() && $template = get_front_page_template() ) : |
|
| 1081 | - elseif ( is_home() && $template = get_home_template() ) : |
|
| 1082 | - elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) : |
|
| 1083 | - elseif ( is_tax() && $template = get_taxonomy_template() ) : |
|
| 1084 | - elseif ( is_attachment() && $template = get_attachment_template() ) : |
|
| 1078 | + if (is_404() && $template = get_404_template()) : |
|
| 1079 | + elseif (is_search() && $template = get_search_template()) : |
|
| 1080 | + elseif (is_front_page() && $template = get_front_page_template()) : |
|
| 1081 | + elseif (is_home() && $template = get_home_template()) : |
|
| 1082 | + elseif (is_post_type_archive() && $template = get_post_type_archive_template()) : |
|
| 1083 | + elseif (is_tax() && $template = get_taxonomy_template()) : |
|
| 1084 | + elseif (is_attachment() && $template = get_attachment_template()) : |
|
| 1085 | 1085 | remove_filter('the_content', 'prepend_attachment'); |
| 1086 | - elseif ( is_single() && $template = get_single_template() ) : |
|
| 1087 | - elseif ( is_page() && $template = get_page_template() ) : |
|
| 1088 | - elseif ( is_category() && $template = get_category_template() ) : |
|
| 1089 | - elseif ( is_tag() && $template = get_tag_template() ) : |
|
| 1090 | - elseif ( is_author() && $template = get_author_template() ) : |
|
| 1091 | - elseif ( is_date() && $template = get_date_template() ) : |
|
| 1092 | - elseif ( is_archive() && $template = get_archive_template() ) : |
|
| 1093 | - elseif ( is_paged() && $template = get_paged_template() ) : |
|
| 1086 | + elseif (is_single() && $template = get_single_template()) : |
|
| 1087 | + elseif (is_page() && $template = get_page_template()) : |
|
| 1088 | + elseif (is_category() && $template = get_category_template()) : |
|
| 1089 | + elseif (is_tag() && $template = get_tag_template()) : |
|
| 1090 | + elseif (is_author() && $template = get_author_template()) : |
|
| 1091 | + elseif (is_date() && $template = get_date_template()) : |
|
| 1092 | + elseif (is_archive() && $template = get_archive_template()) : |
|
| 1093 | + elseif (is_paged() && $template = get_paged_template()) : |
|
| 1094 | 1094 | else : |
| 1095 | 1095 | $template = get_index_template(); |
| 1096 | 1096 | endif; |
@@ -1101,21 +1101,21 @@ discard block |
||
| 1101 | 1101 | * |
| 1102 | 1102 | * @param string $template The path of the template to include. |
| 1103 | 1103 | */ |
| 1104 | - if ( $template = apply_filters( 'template_include', $template ) ) { |
|
| 1105 | - $template_contents = file_get_contents( $template ); |
|
| 1104 | + if ($template = apply_filters('template_include', $template)) { |
|
| 1105 | + $template_contents = file_get_contents($template); |
|
| 1106 | 1106 | $included_header = $included_footer = false; |
| 1107 | - if ( false !== stripos( $template_contents, 'get_header();' ) ) { |
|
| 1108 | - do_action( 'get_header', null ); |
|
| 1109 | - locate_template( 'header.php', true, false ); |
|
| 1107 | + if (false !== stripos($template_contents, 'get_header();')) { |
|
| 1108 | + do_action('get_header', null); |
|
| 1109 | + locate_template('header.php', true, false); |
|
| 1110 | 1110 | $included_header = true; |
| 1111 | 1111 | } |
| 1112 | - include( $template ); |
|
| 1113 | - if ( false !== stripos( $template_contents, 'get_footer();' ) ) { |
|
| 1114 | - do_action( 'get_footer', null ); |
|
| 1115 | - locate_template( 'footer.php', true, false ); |
|
| 1112 | + include($template); |
|
| 1113 | + if (false !== stripos($template_contents, 'get_footer();')) { |
|
| 1114 | + do_action('get_footer', null); |
|
| 1115 | + locate_template('footer.php', true, false); |
|
| 1116 | 1116 | $included_footer = true; |
| 1117 | 1117 | } |
| 1118 | - if ( $included_header && $included_footer ) { |
|
| 1118 | + if ($included_header && $included_footer) { |
|
| 1119 | 1119 | global $wp_scripts; |
| 1120 | 1120 | $wp_scripts->done = array(); |
| 1121 | 1121 | } |
@@ -1123,19 +1123,19 @@ discard block |
||
| 1123 | 1123 | return; |
| 1124 | 1124 | } |
| 1125 | 1125 | |
| 1126 | - public static function setPermalinkStructure( $struc = '/%postname%/' ) { |
|
| 1126 | + public static function setPermalinkStructure($struc = '/%postname%/') { |
|
| 1127 | 1127 | global $wp_rewrite; |
| 1128 | - $wp_rewrite->set_permalink_structure( $struc ); |
|
| 1128 | + $wp_rewrite->set_permalink_structure($struc); |
|
| 1129 | 1129 | $wp_rewrite->flush_rules(); |
| 1130 | - update_option( 'permalink_structure', $struc ); |
|
| 1131 | - flush_rewrite_rules( true ); |
|
| 1130 | + update_option('permalink_structure', $struc); |
|
| 1131 | + flush_rewrite_rules(true); |
|
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | - function the_widget_form( $widget, $instance = array() ) { |
|
| 1134 | + function the_widget_form($widget, $instance = array()) { |
|
| 1135 | 1135 | global $wp_widget_factory; |
| 1136 | 1136 | |
| 1137 | 1137 | $widget_obj = $wp_widget_factory->widgets[$widget]; |
| 1138 | - if ( ! ( $widget_obj instanceof WP_Widget ) ) { |
|
| 1138 | + if (!($widget_obj instanceof WP_Widget)) { |
|
| 1139 | 1139 | return; |
| 1140 | 1140 | } |
| 1141 | 1141 | |
@@ -1143,11 +1143,11 @@ discard block |
||
| 1143 | 1143 | $widget_obj->form($instance); |
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | - function the_widget_form_update( $widget, $new_instance = array(), $old_instance = array() ) { |
|
| 1146 | + function the_widget_form_update($widget, $new_instance = array(), $old_instance = array()) { |
|
| 1147 | 1147 | global $wp_widget_factory; |
| 1148 | 1148 | |
| 1149 | 1149 | $widget_obj = $wp_widget_factory->widgets[$widget]; |
| 1150 | - if ( ! ( $widget_obj instanceof WP_Widget ) ) { |
|
| 1150 | + if (!($widget_obj instanceof WP_Widget)) { |
|
| 1151 | 1151 | return; |
| 1152 | 1152 | } |
| 1153 | 1153 | |
@@ -1,1164 +1,1164 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class GeoDirectoryTests extends WP_UnitTestCase |
| 3 | 3 | { |
| 4 | - public function setUp() |
|
| 5 | - { |
|
| 6 | - parent::setUp(); |
|
| 7 | - wp_set_current_user(1); |
|
| 8 | - |
|
| 9 | - geodir_register_sidebar(); |
|
| 10 | - } |
|
| 11 | - |
|
| 12 | - public function testBreadcrumbs() { |
|
| 13 | - $query_args = array( |
|
| 14 | - 'post_status' => 'publish', |
|
| 15 | - 'post_type' => 'gd_place', |
|
| 16 | - 'posts_per_page' => 1, |
|
| 17 | - ); |
|
| 18 | - |
|
| 19 | - $all_posts = new WP_Query( $query_args ); |
|
| 20 | - $post_id = null; |
|
| 21 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 22 | - $post_id = get_the_ID(); |
|
| 23 | - endwhile; |
|
| 24 | - |
|
| 25 | - $this->assertTrue(is_int($post_id)); |
|
| 26 | - |
|
| 27 | - $this->go_to( get_permalink($post_id) ); |
|
| 28 | - |
|
| 29 | - ob_start(); |
|
| 30 | - geodir_breadcrumb(); |
|
| 31 | - $output = ob_get_contents(); |
|
| 32 | - ob_end_clean(); |
|
| 33 | - $this->assertContains('Places', $output); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - public function testAdminSettingForms() { |
|
| 37 | - $_REQUEST['listing_type'] = 'gd_place'; |
|
| 38 | - ob_start(); |
|
| 39 | - geodir_admin_option_form('general_settings'); |
|
| 40 | - $output = ob_get_contents(); |
|
| 41 | - ob_end_clean(); |
|
| 42 | - $this->assertContains('General Options', $output); |
|
| 43 | - |
|
| 44 | - ob_start(); |
|
| 45 | - geodir_admin_option_form('design_settings'); |
|
| 46 | - $output = ob_get_contents(); |
|
| 47 | - ob_end_clean(); |
|
| 48 | - $this->assertContains('Home Top Section Settings', $output); |
|
| 49 | - |
|
| 50 | - ob_start(); |
|
| 51 | - geodir_admin_option_form('permalink_settings'); |
|
| 52 | - $output = ob_get_contents(); |
|
| 53 | - ob_end_clean(); |
|
| 54 | - $this->assertContains('Listing Detail Permalink Settings', $output); |
|
| 55 | - |
|
| 56 | - ob_start(); |
|
| 57 | - geodir_admin_option_form('title_meta_settings'); |
|
| 58 | - $output = ob_get_contents(); |
|
| 59 | - ob_end_clean(); |
|
| 60 | - $this->assertContains('Homepage Meta Settings', $output); |
|
| 61 | - |
|
| 62 | - ob_start(); |
|
| 63 | - geodir_admin_option_form('notifications_settings'); |
|
| 64 | - $output = ob_get_contents(); |
|
| 65 | - ob_end_clean(); |
|
| 66 | - $this->assertContains('Notification Options', $output); |
|
| 67 | - |
|
| 68 | - ob_start(); |
|
| 69 | - geodir_admin_option_form('default_location_settings'); |
|
| 70 | - $output = ob_get_contents(); |
|
| 71 | - ob_end_clean(); |
|
| 72 | - $this->assertContains('Set Default Location', $output); |
|
| 73 | - |
|
| 74 | - ob_start(); |
|
| 75 | - geodir_admin_option_form('tools_settings'); |
|
| 76 | - $output = ob_get_contents(); |
|
| 77 | - ob_end_clean(); |
|
| 78 | - $this->assertContains('GD Diagnostic Tools', $output); |
|
| 79 | - |
|
| 80 | - ob_start(); |
|
| 81 | - geodir_admin_option_form('compatibility_settings'); |
|
| 82 | - $output = ob_get_contents(); |
|
| 83 | - ob_end_clean(); |
|
| 84 | - $this->assertContains('Theme Compatibility Settings', $output); |
|
| 85 | - |
|
| 86 | - ob_start(); |
|
| 87 | - geodir_admin_option_form('import_export'); |
|
| 88 | - $output = ob_get_contents(); |
|
| 89 | - ob_end_clean(); |
|
| 90 | - $this->assertContains('GD Import & Export CSV', $output); |
|
| 91 | - |
|
| 92 | - $_REQUEST['subtab'] = 'custom_fields'; |
|
| 93 | - ob_start(); |
|
| 94 | - geodir_admin_option_form('gd_place_fields_settings'); |
|
| 95 | - $output = ob_get_contents(); |
|
| 96 | - ob_end_clean(); |
|
| 97 | - $this->assertContains('general-form-builder-frame', $output); |
|
| 98 | - |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - public function testPopPostWidget() { |
|
| 102 | - $args = array( |
|
| 103 | - 'before_widget' => '<ul>', |
|
| 104 | - 'after_widget' => '<ul>', |
|
| 105 | - 'before_title' => '<ul>', |
|
| 106 | - 'after_title' => '<ul>' |
|
| 107 | - ); |
|
| 108 | - ob_start(); |
|
| 109 | - geodir_popular_post_category_output($args); |
|
| 110 | - $output = ob_get_contents(); |
|
| 111 | - ob_end_clean(); |
|
| 112 | - $this->assertContains('Popular Categories', $output); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - public function texstBestOfWidget() { |
|
| 4 | + public function setUp() |
|
| 5 | + { |
|
| 6 | + parent::setUp(); |
|
| 7 | + wp_set_current_user(1); |
|
| 8 | + |
|
| 9 | + geodir_register_sidebar(); |
|
| 10 | + } |
|
| 11 | + |
|
| 12 | + public function testBreadcrumbs() { |
|
| 13 | + $query_args = array( |
|
| 14 | + 'post_status' => 'publish', |
|
| 15 | + 'post_type' => 'gd_place', |
|
| 16 | + 'posts_per_page' => 1, |
|
| 17 | + ); |
|
| 18 | + |
|
| 19 | + $all_posts = new WP_Query( $query_args ); |
|
| 20 | + $post_id = null; |
|
| 21 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 22 | + $post_id = get_the_ID(); |
|
| 23 | + endwhile; |
|
| 24 | + |
|
| 25 | + $this->assertTrue(is_int($post_id)); |
|
| 26 | + |
|
| 27 | + $this->go_to( get_permalink($post_id) ); |
|
| 28 | + |
|
| 29 | + ob_start(); |
|
| 30 | + geodir_breadcrumb(); |
|
| 31 | + $output = ob_get_contents(); |
|
| 32 | + ob_end_clean(); |
|
| 33 | + $this->assertContains('Places', $output); |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + public function testAdminSettingForms() { |
|
| 37 | + $_REQUEST['listing_type'] = 'gd_place'; |
|
| 38 | + ob_start(); |
|
| 39 | + geodir_admin_option_form('general_settings'); |
|
| 40 | + $output = ob_get_contents(); |
|
| 41 | + ob_end_clean(); |
|
| 42 | + $this->assertContains('General Options', $output); |
|
| 43 | + |
|
| 44 | + ob_start(); |
|
| 45 | + geodir_admin_option_form('design_settings'); |
|
| 46 | + $output = ob_get_contents(); |
|
| 47 | + ob_end_clean(); |
|
| 48 | + $this->assertContains('Home Top Section Settings', $output); |
|
| 49 | + |
|
| 50 | + ob_start(); |
|
| 51 | + geodir_admin_option_form('permalink_settings'); |
|
| 52 | + $output = ob_get_contents(); |
|
| 53 | + ob_end_clean(); |
|
| 54 | + $this->assertContains('Listing Detail Permalink Settings', $output); |
|
| 55 | + |
|
| 56 | + ob_start(); |
|
| 57 | + geodir_admin_option_form('title_meta_settings'); |
|
| 58 | + $output = ob_get_contents(); |
|
| 59 | + ob_end_clean(); |
|
| 60 | + $this->assertContains('Homepage Meta Settings', $output); |
|
| 61 | + |
|
| 62 | + ob_start(); |
|
| 63 | + geodir_admin_option_form('notifications_settings'); |
|
| 64 | + $output = ob_get_contents(); |
|
| 65 | + ob_end_clean(); |
|
| 66 | + $this->assertContains('Notification Options', $output); |
|
| 67 | + |
|
| 68 | + ob_start(); |
|
| 69 | + geodir_admin_option_form('default_location_settings'); |
|
| 70 | + $output = ob_get_contents(); |
|
| 71 | + ob_end_clean(); |
|
| 72 | + $this->assertContains('Set Default Location', $output); |
|
| 73 | + |
|
| 74 | + ob_start(); |
|
| 75 | + geodir_admin_option_form('tools_settings'); |
|
| 76 | + $output = ob_get_contents(); |
|
| 77 | + ob_end_clean(); |
|
| 78 | + $this->assertContains('GD Diagnostic Tools', $output); |
|
| 79 | + |
|
| 80 | + ob_start(); |
|
| 81 | + geodir_admin_option_form('compatibility_settings'); |
|
| 82 | + $output = ob_get_contents(); |
|
| 83 | + ob_end_clean(); |
|
| 84 | + $this->assertContains('Theme Compatibility Settings', $output); |
|
| 85 | + |
|
| 86 | + ob_start(); |
|
| 87 | + geodir_admin_option_form('import_export'); |
|
| 88 | + $output = ob_get_contents(); |
|
| 89 | + ob_end_clean(); |
|
| 90 | + $this->assertContains('GD Import & Export CSV', $output); |
|
| 91 | + |
|
| 92 | + $_REQUEST['subtab'] = 'custom_fields'; |
|
| 93 | + ob_start(); |
|
| 94 | + geodir_admin_option_form('gd_place_fields_settings'); |
|
| 95 | + $output = ob_get_contents(); |
|
| 96 | + ob_end_clean(); |
|
| 97 | + $this->assertContains('general-form-builder-frame', $output); |
|
| 98 | + |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + public function testPopPostWidget() { |
|
| 102 | + $args = array( |
|
| 103 | + 'before_widget' => '<ul>', |
|
| 104 | + 'after_widget' => '<ul>', |
|
| 105 | + 'before_title' => '<ul>', |
|
| 106 | + 'after_title' => '<ul>' |
|
| 107 | + ); |
|
| 108 | + ob_start(); |
|
| 109 | + geodir_popular_post_category_output($args); |
|
| 110 | + $output = ob_get_contents(); |
|
| 111 | + ob_end_clean(); |
|
| 112 | + $this->assertContains('Popular Categories', $output); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + public function texstBestOfWidget() { |
|
| 116 | 116 | // $args = array( |
| 117 | 117 | // 'before_widget' => '<ul>', |
| 118 | 118 | // 'after_widget' => '<ul>', |
| 119 | 119 | // 'before_title' => '<ul>', |
| 120 | 120 | // 'after_title' => '<ul>' |
| 121 | 121 | // ); |
| 122 | - include_once geodir_plugin_path() . "/geodirectory-widgets/geodirectory_cpt_categories_widget.php"; |
|
| 123 | - $params = array( |
|
| 124 | - 'title' => '', |
|
| 125 | - 'post_type' => array(), // NULL for all |
|
| 126 | - 'hide_empty' => '', |
|
| 127 | - 'show_count' => '', |
|
| 128 | - 'hide_icon' => '', |
|
| 129 | - 'cpt_left' => '', |
|
| 130 | - 'sort_by' => 'count', |
|
| 131 | - 'max_count' => 'all', |
|
| 132 | - 'max_level' => '1' |
|
| 133 | - ); |
|
| 134 | - ob_start(); |
|
| 135 | - geodir_cpt_categories_output($params); |
|
| 136 | - $output = ob_get_contents(); |
|
| 137 | - ob_end_clean(); |
|
| 138 | - $this->assertContains('gd-cptcat-title', $output); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - public function testGDWidgetListView() { |
|
| 142 | - global $gridview_columns_widget, $geodir_is_widget_listing; |
|
| 143 | - |
|
| 144 | - $_REQUEST['sgeo_lat'] = '40.7127837'; |
|
| 145 | - $_REQUEST['sgeo_lon'] = '-74.00594130000002'; |
|
| 146 | - $query_args = array( |
|
| 147 | - 'posts_per_page' => 1, |
|
| 148 | - 'is_geodir_loop' => true, |
|
| 149 | - 'gd_location' => false, |
|
| 150 | - 'post_type' => 'gd_place', |
|
| 151 | - ); |
|
| 152 | - $widget_listings = geodir_get_widget_listings($query_args); |
|
| 153 | - $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
| 154 | - global $post, $map_jason, $map_canvas_arr; |
|
| 155 | - |
|
| 156 | - $current_post = $post; |
|
| 157 | - $current_map_jason = $map_jason; |
|
| 158 | - $current_map_canvas_arr = $map_canvas_arr; |
|
| 159 | - $geodir_is_widget_listing = true; |
|
| 160 | - |
|
| 161 | - ob_start(); |
|
| 162 | - include($template); |
|
| 163 | - $output = ob_get_contents(); |
|
| 164 | - ob_end_clean(); |
|
| 165 | - $this->assertContains('geodir-entry-content', $output); |
|
| 166 | - |
|
| 167 | - $geodir_is_widget_listing = false; |
|
| 168 | - |
|
| 169 | - $GLOBALS['post'] = $current_post; |
|
| 170 | - if (!empty($current_post)) |
|
| 171 | - setup_postdata($current_post); |
|
| 172 | - $map_jason = $current_map_jason; |
|
| 173 | - $map_canvas_arr = $current_map_canvas_arr; |
|
| 174 | - |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - public function testRegTemplate() { |
|
| 122 | + include_once geodir_plugin_path() . "/geodirectory-widgets/geodirectory_cpt_categories_widget.php"; |
|
| 123 | + $params = array( |
|
| 124 | + 'title' => '', |
|
| 125 | + 'post_type' => array(), // NULL for all |
|
| 126 | + 'hide_empty' => '', |
|
| 127 | + 'show_count' => '', |
|
| 128 | + 'hide_icon' => '', |
|
| 129 | + 'cpt_left' => '', |
|
| 130 | + 'sort_by' => 'count', |
|
| 131 | + 'max_count' => 'all', |
|
| 132 | + 'max_level' => '1' |
|
| 133 | + ); |
|
| 134 | + ob_start(); |
|
| 135 | + geodir_cpt_categories_output($params); |
|
| 136 | + $output = ob_get_contents(); |
|
| 137 | + ob_end_clean(); |
|
| 138 | + $this->assertContains('gd-cptcat-title', $output); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + public function testGDWidgetListView() { |
|
| 142 | + global $gridview_columns_widget, $geodir_is_widget_listing; |
|
| 143 | + |
|
| 144 | + $_REQUEST['sgeo_lat'] = '40.7127837'; |
|
| 145 | + $_REQUEST['sgeo_lon'] = '-74.00594130000002'; |
|
| 146 | + $query_args = array( |
|
| 147 | + 'posts_per_page' => 1, |
|
| 148 | + 'is_geodir_loop' => true, |
|
| 149 | + 'gd_location' => false, |
|
| 150 | + 'post_type' => 'gd_place', |
|
| 151 | + ); |
|
| 152 | + $widget_listings = geodir_get_widget_listings($query_args); |
|
| 153 | + $template = apply_filters("geodir_template_part-widget-listing-listview", geodir_locate_template('widget-listing-listview')); |
|
| 154 | + global $post, $map_jason, $map_canvas_arr; |
|
| 155 | + |
|
| 156 | + $current_post = $post; |
|
| 157 | + $current_map_jason = $map_jason; |
|
| 158 | + $current_map_canvas_arr = $map_canvas_arr; |
|
| 159 | + $geodir_is_widget_listing = true; |
|
| 160 | + |
|
| 161 | + ob_start(); |
|
| 162 | + include($template); |
|
| 163 | + $output = ob_get_contents(); |
|
| 164 | + ob_end_clean(); |
|
| 165 | + $this->assertContains('geodir-entry-content', $output); |
|
| 166 | + |
|
| 167 | + $geodir_is_widget_listing = false; |
|
| 168 | + |
|
| 169 | + $GLOBALS['post'] = $current_post; |
|
| 170 | + if (!empty($current_post)) |
|
| 171 | + setup_postdata($current_post); |
|
| 172 | + $map_jason = $current_map_jason; |
|
| 173 | + $map_canvas_arr = $current_map_canvas_arr; |
|
| 174 | + |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + public function testRegTemplate() { |
|
| 178 | 178 | // var_dump(geodir_login_page_id()); |
| 179 | - wp_set_current_user(0); |
|
| 180 | - $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php'; |
|
| 181 | - |
|
| 182 | - ob_start(); |
|
| 183 | - include($template); |
|
| 184 | - $output = ob_get_contents(); |
|
| 185 | - ob_end_clean(); |
|
| 186 | - $this->assertContains('Sign In', $output); |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - public function testInfoTemplate() { |
|
| 190 | - wp_set_current_user(1); |
|
| 191 | - global $information; |
|
| 192 | - $information = "hello world"; |
|
| 193 | - |
|
| 194 | - $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; |
|
| 195 | - |
|
| 196 | - ob_start(); |
|
| 197 | - include($template); |
|
| 198 | - $output = ob_get_contents(); |
|
| 199 | - ob_end_clean(); |
|
| 200 | - $this->assertContains('hello world', $output); |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - public function testSuccessPage() { |
|
| 204 | - wp_set_current_user(1); |
|
| 205 | - |
|
| 206 | - $query_args = array( |
|
| 207 | - 'post_status' => 'publish', |
|
| 208 | - 'post_type' => 'gd_place', |
|
| 209 | - 'posts_per_page' => 1, |
|
| 210 | - ); |
|
| 211 | - |
|
| 212 | - $all_posts = new WP_Query( $query_args ); |
|
| 213 | - $post_id = null; |
|
| 214 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 215 | - $post_id = get_the_ID(); |
|
| 216 | - endwhile; |
|
| 217 | - |
|
| 218 | - $this->assertTrue(is_int($post_id)); |
|
| 219 | - |
|
| 220 | - $_REQUEST['listing_type'] = 'gd_place'; |
|
| 221 | - $_REQUEST['pid'] = $post_id; |
|
| 222 | - ob_start(); |
|
| 223 | - $this->go_to( get_permalink(geodir_success_page_id()) ); |
|
| 224 | - $this->load_template(); |
|
| 225 | - $output = ob_get_contents(); |
|
| 226 | - ob_end_clean(); |
|
| 227 | - $this->assertContains('View your submitted information', $output); |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - public function testPreviewPage() { |
|
| 231 | - wp_set_current_user(1); |
|
| 232 | - |
|
| 233 | - $query_args = array( |
|
| 234 | - 'post_status' => 'publish', |
|
| 235 | - 'post_type' => 'gd_place', |
|
| 236 | - 'posts_per_page' => 1, |
|
| 237 | - ); |
|
| 238 | - |
|
| 239 | - $all_posts = new WP_Query( $query_args ); |
|
| 240 | - $post_id = null; |
|
| 241 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 242 | - $post_id = get_the_ID(); |
|
| 243 | - endwhile; |
|
| 244 | - |
|
| 245 | - $this->assertTrue(is_int($post_id)); |
|
| 246 | - |
|
| 247 | - $_REQUEST = array( |
|
| 248 | - 'pid' => $post_id, |
|
| 249 | - 'listing_type' => 'gd_place', |
|
| 250 | - 'post_title' => 'Test Listing Title Modified', |
|
| 251 | - 'post_desc' => 'Test Desc', |
|
| 252 | - 'post_tags' => 'test1,test2', |
|
| 253 | - 'post_address' => 'New York City Hall', |
|
| 254 | - 'post_zip' => '10007', |
|
| 255 | - 'post_latitude' => '40.7127837', |
|
| 256 | - 'post_longitude' => '-74.00594130000002', |
|
| 257 | - 'post_mapview' => 'ROADMAP', |
|
| 258 | - 'post_mapzoom' => '10', |
|
| 259 | - 'geodir_timing' => '10.00 am to 6 pm every day', |
|
| 260 | - 'geodir_contact' => '1234567890', |
|
| 261 | - 'geodir_email' => '[email protected]', |
|
| 262 | - 'geodir_website' => 'http://test.com', |
|
| 263 | - 'geodir_twitter' => 'http://twitter.com/test', |
|
| 264 | - 'geodir_facebook' => 'http://facebook.com/test', |
|
| 265 | - 'geodir_special_offers' => 'Test offer', |
|
| 266 | - 'preview' => true, |
|
| 267 | - 'post_category' => array( |
|
| 268 | - 'gd_placecategory' => '' |
|
| 269 | - ) |
|
| 270 | - ); |
|
| 271 | - |
|
| 272 | - ob_start(); |
|
| 273 | - $this->go_to( get_permalink(geodir_preview_page_id()) ); |
|
| 274 | - $this->load_template(); |
|
| 275 | - $output = ob_get_contents(); |
|
| 276 | - ob_end_clean(); |
|
| 277 | - $this->assertContains('This is a preview of your listing', $output); |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - public function testAddListingPage() { |
|
| 281 | - wp_set_current_user(1); |
|
| 282 | - |
|
| 283 | - ob_start(); |
|
| 284 | - $this->go_to( get_permalink(geodir_add_listing_page_id()) ); |
|
| 285 | - $this->load_template(); |
|
| 286 | - $output = ob_get_contents(); |
|
| 287 | - ob_end_clean(); |
|
| 288 | - $this->assertContains('Enter Listing Details', $output); |
|
| 289 | - } |
|
| 290 | - |
|
| 291 | - public function testLocationPage() { |
|
| 292 | - wp_set_current_user(1); |
|
| 293 | - |
|
| 294 | - ob_start(); |
|
| 295 | - $this->go_to( get_permalink(geodir_location_page_id()) ); |
|
| 296 | - $this->load_template(); |
|
| 297 | - $output = ob_get_contents(); |
|
| 298 | - ob_end_clean(); |
|
| 299 | - $this->assertContains('Location', $output); |
|
| 300 | - } |
|
| 301 | - |
|
| 302 | - public function testTemplates() { |
|
| 303 | - |
|
| 304 | - global $current_user; |
|
| 305 | - |
|
| 306 | - $user_id = $current_user->ID; |
|
| 307 | - |
|
| 308 | - $this->setPermalinkStructure(); |
|
| 309 | - |
|
| 310 | - $homepage = get_page_by_title( 'GD Home page' ); |
|
| 311 | - if ( $homepage ) |
|
| 312 | - { |
|
| 313 | - update_option( 'page_on_front', $homepage->ID ); |
|
| 314 | - update_option( 'show_on_front', 'page' ); |
|
| 315 | - } |
|
| 316 | - |
|
| 317 | - ob_start(); |
|
| 318 | - $this->go_to( home_url('/') ); |
|
| 319 | - $this->load_template(); |
|
| 320 | - $output = ob_get_contents(); |
|
| 321 | - ob_end_clean(); |
|
| 322 | - $this->assertContains('body class="home', $output); |
|
| 323 | - |
|
| 324 | - |
|
| 325 | - ob_start(); |
|
| 326 | - $this->go_to( home_url('/?post_type=gd_place') ); |
|
| 327 | - $this->load_template(); |
|
| 328 | - $output = ob_get_contents(); |
|
| 329 | - ob_end_clean(); |
|
| 330 | - $this->assertContains('All Places', $output); |
|
| 331 | - |
|
| 332 | - $query_args = array( |
|
| 333 | - 'post_status' => 'publish', |
|
| 334 | - 'post_type' => 'gd_place', |
|
| 335 | - 'posts_per_page' => 1, |
|
| 336 | - ); |
|
| 337 | - |
|
| 338 | - $all_posts = new WP_Query( $query_args ); |
|
| 339 | - $post_id = null; |
|
| 340 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 341 | - $post_id = get_the_ID(); |
|
| 342 | - endwhile; |
|
| 343 | - |
|
| 344 | - $this->assertTrue(is_int($post_id)); |
|
| 345 | - |
|
| 346 | - global $preview; |
|
| 347 | - $preview = false; |
|
| 348 | - ob_start(); |
|
| 349 | - $this->go_to( get_permalink($post_id) ); |
|
| 350 | - $this->load_template(); |
|
| 351 | - $output = ob_get_contents(); |
|
| 352 | - ob_end_clean(); |
|
| 353 | - $this->assertContains('post_profileTab', $output); |
|
| 354 | - |
|
| 355 | - ob_start(); |
|
| 356 | - $_REQUEST['stype'] = 'gd_place'; |
|
| 357 | - $_REQUEST['geodir_dashbord'] = true; |
|
| 358 | - $this->go_to( get_author_posts_url($user_id) ); |
|
| 359 | - $this->load_template(); |
|
| 360 | - $output = ob_get_contents(); |
|
| 361 | - ob_end_clean(); |
|
| 362 | - $this->assertContains('gd_list_view', $output); |
|
| 363 | - |
|
| 364 | - } |
|
| 365 | - |
|
| 366 | - public function testSearchPage() { |
|
| 367 | - ob_start(); |
|
| 368 | - $_REQUEST['geodir_search'] = "1"; |
|
| 369 | - $_REQUEST['stype'] = 'gd_place'; |
|
| 370 | - $this->go_to( home_url('/?geodir_search=1&stype=gd_place&s=test&snear=&sgeo_lat=&sgeo_lon=') ); |
|
| 371 | - $this->load_template(); |
|
| 372 | - $output = ob_get_contents(); |
|
| 373 | - ob_end_clean(); |
|
| 374 | - $this->assertContains('Search Results for', $output); |
|
| 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 | - |
|
| 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'; |
|
| 437 | - $menulocation = 'primary'; |
|
| 438 | - // Does the menu exist already? |
|
| 439 | - $menu_exists = wp_get_nav_menu_object( $menuname ); |
|
| 440 | - |
|
| 441 | - // If it doesn't exist, let's create it. |
|
| 442 | - if( !$menu_exists){ |
|
| 443 | - $menu_id = wp_create_nav_menu($menuname); |
|
| 444 | - |
|
| 445 | - // Set up default BuddyPress links and add them to the menu. |
|
| 446 | - wp_update_nav_menu_item($menu_id, 0, array( |
|
| 447 | - 'menu-item-title' => __('Home'), |
|
| 448 | - 'menu-item-classes' => 'home', |
|
| 449 | - 'menu-item-url' => home_url( '/' ), |
|
| 450 | - 'menu-item-status' => 'publish')); |
|
| 451 | - |
|
| 452 | - if( !has_nav_menu( $menulocation ) ){ |
|
| 453 | - $locations = get_theme_mod('nav_menu_locations'); |
|
| 454 | - $locations[$menulocation] = $menu_id; |
|
| 455 | - set_theme_mod( 'nav_menu_locations', $locations ); |
|
| 456 | - } |
|
| 457 | - |
|
| 458 | - update_option('geodir_theme_location_nav', array('primary')); |
|
| 459 | - |
|
| 460 | - $menu = wp_nav_menu(array( |
|
| 461 | - 'theme_location' => 'primary', |
|
| 462 | - 'echo' => false, |
|
| 463 | - )); |
|
| 464 | - |
|
| 465 | - $this->assertContains('Add Listing', $menu); |
|
| 466 | - |
|
| 467 | - |
|
| 468 | - } |
|
| 469 | - } |
|
| 470 | - |
|
| 471 | - public function testBestOfWidget() { |
|
| 472 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
| 473 | - include_once($template); |
|
| 474 | - |
|
| 475 | - ob_start(); |
|
| 476 | - $instance = array(); |
|
| 477 | - $instance['use_viewing_post_type'] = '1'; |
|
| 478 | - $instance['excerpt_type'] = 'show-reviews'; |
|
| 479 | - the_widget( 'geodir_bestof_widget' ); |
|
| 480 | - $output = ob_get_contents(); |
|
| 481 | - ob_end_clean(); |
|
| 482 | - $this->assertContains('bestof-widget-tab-layout', $output); |
|
| 483 | - |
|
| 484 | - ob_start(); |
|
| 485 | - $this->the_widget_form( 'geodir_bestof_widget' ); |
|
| 486 | - $output = ob_get_contents(); |
|
| 487 | - ob_end_clean(); |
|
| 488 | - $this->assertContains('Number of categories', $output); |
|
| 489 | - |
|
| 490 | - $new_instance = array( |
|
| 491 | - 'title' => '', |
|
| 492 | - 'post_type' => '', |
|
| 493 | - 'post_limit' => '5', |
|
| 494 | - 'categ_limit' => '3', |
|
| 495 | - 'character_count' => '20', |
|
| 496 | - 'add_location_filter' => '1', |
|
| 497 | - 'tab_layout' => 'bestof-tabs-on-top', |
|
| 498 | - 'excerpt_type' => 'show-desc', |
|
| 499 | - 'use_viewing_post_type' => '1' |
|
| 500 | - ); |
|
| 501 | - $output = $this->the_widget_form_update( 'geodir_bestof_widget', $new_instance ); |
|
| 502 | - $this->assertContains('20', $output['character_count']); |
|
| 503 | - |
|
| 504 | - ob_start(); |
|
| 505 | - geodir_bestof_js(); |
|
| 506 | - $output = ob_get_contents(); |
|
| 507 | - ob_end_clean(); |
|
| 508 | - $this->assertContains('bestof-widget-tab-layout', $output); |
|
| 509 | - |
|
| 510 | - } |
|
| 511 | - |
|
| 512 | - public function testCptCatsWidget() { |
|
| 513 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_cpt_categories_widget.php'; |
|
| 514 | - include_once($template); |
|
| 515 | - |
|
| 516 | - ob_start(); |
|
| 517 | - the_widget( 'geodir_cpt_categories_widget' ); |
|
| 518 | - $output = ob_get_contents(); |
|
| 519 | - ob_end_clean(); |
|
| 520 | - $this->assertContains('geodir_cpt_categories_widget', $output); |
|
| 521 | - |
|
| 522 | - ob_start(); |
|
| 523 | - $this->the_widget_form( 'geodir_cpt_categories_widget' ); |
|
| 524 | - $output = ob_get_contents(); |
|
| 525 | - ob_end_clean(); |
|
| 526 | - $this->assertContains('Select CPT', $output); |
|
| 527 | - |
|
| 528 | - $new_instance = array( |
|
| 529 | - 'title' => '', |
|
| 530 | - 'post_type' => array(), // NULL for all |
|
| 531 | - 'hide_empty' => '', |
|
| 532 | - 'show_count' => '', |
|
| 533 | - 'hide_icon' => '', |
|
| 534 | - 'cpt_left' => '', |
|
| 535 | - 'sort_by' => 'count', |
|
| 536 | - 'max_count' => 'all', |
|
| 537 | - 'max_level' => '1' |
|
| 538 | - ); |
|
| 539 | - $output = $this->the_widget_form_update( 'geodir_cpt_categories_widget', $new_instance ); |
|
| 540 | - $this->assertContains('count', $output['sort_by']); |
|
| 541 | - |
|
| 542 | - } |
|
| 543 | - |
|
| 544 | - public function testFeaturesWidget() { |
|
| 545 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_features_widget.php'; |
|
| 546 | - include_once($template); |
|
| 547 | - |
|
| 548 | - $instance = array( |
|
| 549 | - 'title' => 'Features', |
|
| 550 | - 'icon_color' => '', |
|
| 551 | - 'title1' => 'Hello World', |
|
| 552 | - 'image1' => 'fa-recycle', |
|
| 553 | - 'desc1' => 'cool', |
|
| 554 | - ); |
|
| 555 | - |
|
| 556 | - ob_start(); |
|
| 557 | - the_widget( 'Geodir_Features_Widget', $instance); |
|
| 558 | - $output = ob_get_contents(); |
|
| 559 | - ob_end_clean(); |
|
| 560 | - $this->assertContains('widget_gd_features', $output); |
|
| 561 | - |
|
| 562 | - ob_start(); |
|
| 563 | - $this->the_widget_form( 'Geodir_Features_Widget', $instance ); |
|
| 564 | - $output = ob_get_contents(); |
|
| 565 | - ob_end_clean(); |
|
| 566 | - $this->assertContains('Font Awesome Icon Color', $output); |
|
| 567 | - |
|
| 568 | - $new_instance = array( |
|
| 569 | - 'title' => 'Features', |
|
| 570 | - 'icon_color' => '', |
|
| 571 | - 'title1' => 'Hello World', |
|
| 572 | - 'image1' => 'fa-recycle', |
|
| 573 | - 'desc1' => 'cool', |
|
| 574 | - ); |
|
| 575 | - $output = $this->the_widget_form_update( 'Geodir_Features_Widget', $new_instance ); |
|
| 576 | - $this->assertContains('Features', $output['title']); |
|
| 577 | - |
|
| 578 | - } |
|
| 579 | - |
|
| 580 | - public function testSliderWidget() { |
|
| 581 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_listing_slider_widget.php'; |
|
| 582 | - include_once($template); |
|
| 583 | - |
|
| 584 | - ob_start(); |
|
| 585 | - the_widget( 'geodir_listing_slider_widget' ); |
|
| 586 | - $output = ob_get_contents(); |
|
| 587 | - ob_end_clean(); |
|
| 588 | - $this->assertContains('geodir_listing_slider_view', $output); |
|
| 589 | - |
|
| 590 | - ob_start(); |
|
| 591 | - $this->the_widget_form( 'geodir_listing_slider_widget' ); |
|
| 592 | - $output = ob_get_contents(); |
|
| 593 | - ob_end_clean(); |
|
| 594 | - $this->assertContains('Slide Show Speed', $output); |
|
| 595 | - |
|
| 596 | - $new_instance = array( |
|
| 597 | - 'title' => '', |
|
| 598 | - 'post_type' => '', |
|
| 599 | - 'category' => '', |
|
| 600 | - 'post_number' => '5', |
|
| 601 | - 'max_show' => '1', |
|
| 602 | - 'slide_width' => '', |
|
| 603 | - 'show_title' => '', |
|
| 604 | - 'slideshow' => '', |
|
| 605 | - 'animationLoop' => '', |
|
| 606 | - 'directionNav' => '', |
|
| 607 | - 'slideshowSpeed' => 5000, |
|
| 608 | - 'animationSpeed' => 600, |
|
| 609 | - 'animation' => '', |
|
| 610 | - 'list_sort' => 'latest', |
|
| 611 | - 'show_featured_only' => '', |
|
| 612 | - ); |
|
| 613 | - $output = $this->the_widget_form_update( 'geodir_listing_slider_widget', $new_instance ); |
|
| 614 | - $this->assertContains('latest', $output['list_sort']); |
|
| 615 | - |
|
| 616 | - } |
|
| 617 | - |
|
| 618 | - public function testPopularWidget() { |
|
| 619 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_popular_widget.php'; |
|
| 620 | - include_once($template); |
|
| 621 | - |
|
| 622 | - ob_start(); |
|
| 623 | - the_widget( 'geodir_popular_post_category' ); |
|
| 624 | - $output = ob_get_contents(); |
|
| 625 | - ob_end_clean(); |
|
| 626 | - $this->assertContains('geodir_popular_post_category', $output); |
|
| 627 | - |
|
| 628 | - ob_start(); |
|
| 629 | - $this->the_widget_form( 'geodir_popular_post_category' ); |
|
| 630 | - $output = ob_get_contents(); |
|
| 631 | - ob_end_clean(); |
|
| 632 | - $this->assertContains('Default post type to use', $output); |
|
| 633 | - |
|
| 634 | - $new_instance = array( |
|
| 635 | - 'title' => '', |
|
| 636 | - 'category_limit' => 15, |
|
| 637 | - 'default_post_type' => '' |
|
| 638 | - ); |
|
| 639 | - $output = $this->the_widget_form_update( 'geodir_popular_post_category', $new_instance ); |
|
| 640 | - $this->assertEquals(15, $output['category_limit']); |
|
| 641 | - |
|
| 642 | - ob_start(); |
|
| 643 | - $instance = array(); |
|
| 644 | - $instance['category_title'] = ''; |
|
| 645 | - the_widget( 'geodir_popular_postview', $instance ); |
|
| 646 | - $output = ob_get_contents(); |
|
| 647 | - ob_end_clean(); |
|
| 648 | - $this->assertContains('geodir_popular_post_view', $output); |
|
| 649 | - |
|
| 650 | - ob_start(); |
|
| 651 | - $this->the_widget_form( 'geodir_popular_postview' ); |
|
| 652 | - $output = ob_get_contents(); |
|
| 653 | - ob_end_clean(); |
|
| 654 | - $this->assertContains('Post Category', $output); |
|
| 655 | - |
|
| 656 | - $new_instance = array( |
|
| 657 | - 'title' => '', |
|
| 658 | - 'post_type' => '', |
|
| 659 | - 'category' => array(), |
|
| 660 | - 'category_title' => '', |
|
| 661 | - 'list_sort' => '', |
|
| 662 | - 'list_order' => '', |
|
| 663 | - 'post_number' => '5', |
|
| 664 | - 'layout' => 'gridview_onehalf', |
|
| 665 | - 'listing_width' => '', |
|
| 666 | - 'add_location_filter' => '1', |
|
| 667 | - 'character_count' => '20', |
|
| 668 | - 'show_featured_only' => '', |
|
| 669 | - 'show_special_only' => '', |
|
| 670 | - 'with_pics_only' => '', |
|
| 671 | - 'with_videos_only' => '', |
|
| 672 | - 'use_viewing_post_type' => '' |
|
| 673 | - ); |
|
| 674 | - $output = $this->the_widget_form_update( 'geodir_popular_postview', $new_instance ); |
|
| 675 | - $this->assertContains('gridview_onehalf', $output['layout']); |
|
| 676 | - |
|
| 677 | - } |
|
| 678 | - |
|
| 679 | - public function testRelatedWidget() { |
|
| 680 | - $query_args = array( |
|
| 681 | - 'post_status' => 'publish', |
|
| 682 | - 'post_type' => 'gd_place', |
|
| 683 | - 'posts_per_page' => 1, |
|
| 684 | - ); |
|
| 685 | - |
|
| 686 | - $all_posts = new WP_Query( $query_args ); |
|
| 687 | - $post_id = null; |
|
| 688 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 689 | - global $post; |
|
| 690 | - $post_id = get_the_ID(); |
|
| 691 | - $post = geodir_get_post_info($post->ID); |
|
| 179 | + wp_set_current_user(0); |
|
| 180 | + $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php'; |
|
| 181 | + |
|
| 182 | + ob_start(); |
|
| 183 | + include($template); |
|
| 184 | + $output = ob_get_contents(); |
|
| 185 | + ob_end_clean(); |
|
| 186 | + $this->assertContains('Sign In', $output); |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + public function testInfoTemplate() { |
|
| 190 | + wp_set_current_user(1); |
|
| 191 | + global $information; |
|
| 192 | + $information = "hello world"; |
|
| 193 | + |
|
| 194 | + $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; |
|
| 195 | + |
|
| 196 | + ob_start(); |
|
| 197 | + include($template); |
|
| 198 | + $output = ob_get_contents(); |
|
| 199 | + ob_end_clean(); |
|
| 200 | + $this->assertContains('hello world', $output); |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + public function testSuccessPage() { |
|
| 204 | + wp_set_current_user(1); |
|
| 205 | + |
|
| 206 | + $query_args = array( |
|
| 207 | + 'post_status' => 'publish', |
|
| 208 | + 'post_type' => 'gd_place', |
|
| 209 | + 'posts_per_page' => 1, |
|
| 210 | + ); |
|
| 211 | + |
|
| 212 | + $all_posts = new WP_Query( $query_args ); |
|
| 213 | + $post_id = null; |
|
| 214 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 215 | + $post_id = get_the_ID(); |
|
| 216 | + endwhile; |
|
| 217 | + |
|
| 218 | + $this->assertTrue(is_int($post_id)); |
|
| 219 | + |
|
| 220 | + $_REQUEST['listing_type'] = 'gd_place'; |
|
| 221 | + $_REQUEST['pid'] = $post_id; |
|
| 222 | + ob_start(); |
|
| 223 | + $this->go_to( get_permalink(geodir_success_page_id()) ); |
|
| 224 | + $this->load_template(); |
|
| 225 | + $output = ob_get_contents(); |
|
| 226 | + ob_end_clean(); |
|
| 227 | + $this->assertContains('View your submitted information', $output); |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + public function testPreviewPage() { |
|
| 231 | + wp_set_current_user(1); |
|
| 232 | + |
|
| 233 | + $query_args = array( |
|
| 234 | + 'post_status' => 'publish', |
|
| 235 | + 'post_type' => 'gd_place', |
|
| 236 | + 'posts_per_page' => 1, |
|
| 237 | + ); |
|
| 238 | + |
|
| 239 | + $all_posts = new WP_Query( $query_args ); |
|
| 240 | + $post_id = null; |
|
| 241 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 242 | + $post_id = get_the_ID(); |
|
| 243 | + endwhile; |
|
| 244 | + |
|
| 245 | + $this->assertTrue(is_int($post_id)); |
|
| 246 | + |
|
| 247 | + $_REQUEST = array( |
|
| 248 | + 'pid' => $post_id, |
|
| 249 | + 'listing_type' => 'gd_place', |
|
| 250 | + 'post_title' => 'Test Listing Title Modified', |
|
| 251 | + 'post_desc' => 'Test Desc', |
|
| 252 | + 'post_tags' => 'test1,test2', |
|
| 253 | + 'post_address' => 'New York City Hall', |
|
| 254 | + 'post_zip' => '10007', |
|
| 255 | + 'post_latitude' => '40.7127837', |
|
| 256 | + 'post_longitude' => '-74.00594130000002', |
|
| 257 | + 'post_mapview' => 'ROADMAP', |
|
| 258 | + 'post_mapzoom' => '10', |
|
| 259 | + 'geodir_timing' => '10.00 am to 6 pm every day', |
|
| 260 | + 'geodir_contact' => '1234567890', |
|
| 261 | + 'geodir_email' => '[email protected]', |
|
| 262 | + 'geodir_website' => 'http://test.com', |
|
| 263 | + 'geodir_twitter' => 'http://twitter.com/test', |
|
| 264 | + 'geodir_facebook' => 'http://facebook.com/test', |
|
| 265 | + 'geodir_special_offers' => 'Test offer', |
|
| 266 | + 'preview' => true, |
|
| 267 | + 'post_category' => array( |
|
| 268 | + 'gd_placecategory' => '' |
|
| 269 | + ) |
|
| 270 | + ); |
|
| 271 | + |
|
| 272 | + ob_start(); |
|
| 273 | + $this->go_to( get_permalink(geodir_preview_page_id()) ); |
|
| 274 | + $this->load_template(); |
|
| 275 | + $output = ob_get_contents(); |
|
| 276 | + ob_end_clean(); |
|
| 277 | + $this->assertContains('This is a preview of your listing', $output); |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + public function testAddListingPage() { |
|
| 281 | + wp_set_current_user(1); |
|
| 282 | + |
|
| 283 | + ob_start(); |
|
| 284 | + $this->go_to( get_permalink(geodir_add_listing_page_id()) ); |
|
| 285 | + $this->load_template(); |
|
| 286 | + $output = ob_get_contents(); |
|
| 287 | + ob_end_clean(); |
|
| 288 | + $this->assertContains('Enter Listing Details', $output); |
|
| 289 | + } |
|
| 290 | + |
|
| 291 | + public function testLocationPage() { |
|
| 292 | + wp_set_current_user(1); |
|
| 293 | + |
|
| 294 | + ob_start(); |
|
| 295 | + $this->go_to( get_permalink(geodir_location_page_id()) ); |
|
| 296 | + $this->load_template(); |
|
| 297 | + $output = ob_get_contents(); |
|
| 298 | + ob_end_clean(); |
|
| 299 | + $this->assertContains('Location', $output); |
|
| 300 | + } |
|
| 301 | + |
|
| 302 | + public function testTemplates() { |
|
| 303 | + |
|
| 304 | + global $current_user; |
|
| 305 | + |
|
| 306 | + $user_id = $current_user->ID; |
|
| 307 | + |
|
| 308 | + $this->setPermalinkStructure(); |
|
| 309 | + |
|
| 310 | + $homepage = get_page_by_title( 'GD Home page' ); |
|
| 311 | + if ( $homepage ) |
|
| 312 | + { |
|
| 313 | + update_option( 'page_on_front', $homepage->ID ); |
|
| 314 | + update_option( 'show_on_front', 'page' ); |
|
| 315 | + } |
|
| 316 | + |
|
| 317 | + ob_start(); |
|
| 318 | + $this->go_to( home_url('/') ); |
|
| 319 | + $this->load_template(); |
|
| 320 | + $output = ob_get_contents(); |
|
| 321 | + ob_end_clean(); |
|
| 322 | + $this->assertContains('body class="home', $output); |
|
| 323 | + |
|
| 324 | + |
|
| 325 | + ob_start(); |
|
| 326 | + $this->go_to( home_url('/?post_type=gd_place') ); |
|
| 327 | + $this->load_template(); |
|
| 328 | + $output = ob_get_contents(); |
|
| 329 | + ob_end_clean(); |
|
| 330 | + $this->assertContains('All Places', $output); |
|
| 331 | + |
|
| 332 | + $query_args = array( |
|
| 333 | + 'post_status' => 'publish', |
|
| 334 | + 'post_type' => 'gd_place', |
|
| 335 | + 'posts_per_page' => 1, |
|
| 336 | + ); |
|
| 337 | + |
|
| 338 | + $all_posts = new WP_Query( $query_args ); |
|
| 339 | + $post_id = null; |
|
| 340 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 341 | + $post_id = get_the_ID(); |
|
| 342 | + endwhile; |
|
| 343 | + |
|
| 344 | + $this->assertTrue(is_int($post_id)); |
|
| 345 | + |
|
| 346 | + global $preview; |
|
| 347 | + $preview = false; |
|
| 348 | + ob_start(); |
|
| 349 | + $this->go_to( get_permalink($post_id) ); |
|
| 350 | + $this->load_template(); |
|
| 351 | + $output = ob_get_contents(); |
|
| 352 | + ob_end_clean(); |
|
| 353 | + $this->assertContains('post_profileTab', $output); |
|
| 354 | + |
|
| 355 | + ob_start(); |
|
| 356 | + $_REQUEST['stype'] = 'gd_place'; |
|
| 357 | + $_REQUEST['geodir_dashbord'] = true; |
|
| 358 | + $this->go_to( get_author_posts_url($user_id) ); |
|
| 359 | + $this->load_template(); |
|
| 360 | + $output = ob_get_contents(); |
|
| 361 | + ob_end_clean(); |
|
| 362 | + $this->assertContains('gd_list_view', $output); |
|
| 363 | + |
|
| 364 | + } |
|
| 365 | + |
|
| 366 | + public function testSearchPage() { |
|
| 367 | + ob_start(); |
|
| 368 | + $_REQUEST['geodir_search'] = "1"; |
|
| 369 | + $_REQUEST['stype'] = 'gd_place'; |
|
| 370 | + $this->go_to( home_url('/?geodir_search=1&stype=gd_place&s=test&snear=&sgeo_lat=&sgeo_lon=') ); |
|
| 371 | + $this->load_template(); |
|
| 372 | + $output = ob_get_contents(); |
|
| 373 | + ob_end_clean(); |
|
| 374 | + $this->assertContains('Search Results for', $output); |
|
| 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 | + |
|
| 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'; |
|
| 437 | + $menulocation = 'primary'; |
|
| 438 | + // Does the menu exist already? |
|
| 439 | + $menu_exists = wp_get_nav_menu_object( $menuname ); |
|
| 440 | + |
|
| 441 | + // If it doesn't exist, let's create it. |
|
| 442 | + if( !$menu_exists){ |
|
| 443 | + $menu_id = wp_create_nav_menu($menuname); |
|
| 444 | + |
|
| 445 | + // Set up default BuddyPress links and add them to the menu. |
|
| 446 | + wp_update_nav_menu_item($menu_id, 0, array( |
|
| 447 | + 'menu-item-title' => __('Home'), |
|
| 448 | + 'menu-item-classes' => 'home', |
|
| 449 | + 'menu-item-url' => home_url( '/' ), |
|
| 450 | + 'menu-item-status' => 'publish')); |
|
| 451 | + |
|
| 452 | + if( !has_nav_menu( $menulocation ) ){ |
|
| 453 | + $locations = get_theme_mod('nav_menu_locations'); |
|
| 454 | + $locations[$menulocation] = $menu_id; |
|
| 455 | + set_theme_mod( 'nav_menu_locations', $locations ); |
|
| 456 | + } |
|
| 457 | + |
|
| 458 | + update_option('geodir_theme_location_nav', array('primary')); |
|
| 459 | + |
|
| 460 | + $menu = wp_nav_menu(array( |
|
| 461 | + 'theme_location' => 'primary', |
|
| 462 | + 'echo' => false, |
|
| 463 | + )); |
|
| 464 | + |
|
| 465 | + $this->assertContains('Add Listing', $menu); |
|
| 466 | + |
|
| 467 | + |
|
| 468 | + } |
|
| 469 | + } |
|
| 470 | + |
|
| 471 | + public function testBestOfWidget() { |
|
| 472 | + $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
| 473 | + include_once($template); |
|
| 474 | + |
|
| 475 | + ob_start(); |
|
| 476 | + $instance = array(); |
|
| 477 | + $instance['use_viewing_post_type'] = '1'; |
|
| 478 | + $instance['excerpt_type'] = 'show-reviews'; |
|
| 479 | + the_widget( 'geodir_bestof_widget' ); |
|
| 480 | + $output = ob_get_contents(); |
|
| 481 | + ob_end_clean(); |
|
| 482 | + $this->assertContains('bestof-widget-tab-layout', $output); |
|
| 483 | + |
|
| 484 | + ob_start(); |
|
| 485 | + $this->the_widget_form( 'geodir_bestof_widget' ); |
|
| 486 | + $output = ob_get_contents(); |
|
| 487 | + ob_end_clean(); |
|
| 488 | + $this->assertContains('Number of categories', $output); |
|
| 489 | + |
|
| 490 | + $new_instance = array( |
|
| 491 | + 'title' => '', |
|
| 492 | + 'post_type' => '', |
|
| 493 | + 'post_limit' => '5', |
|
| 494 | + 'categ_limit' => '3', |
|
| 495 | + 'character_count' => '20', |
|
| 496 | + 'add_location_filter' => '1', |
|
| 497 | + 'tab_layout' => 'bestof-tabs-on-top', |
|
| 498 | + 'excerpt_type' => 'show-desc', |
|
| 499 | + 'use_viewing_post_type' => '1' |
|
| 500 | + ); |
|
| 501 | + $output = $this->the_widget_form_update( 'geodir_bestof_widget', $new_instance ); |
|
| 502 | + $this->assertContains('20', $output['character_count']); |
|
| 503 | + |
|
| 504 | + ob_start(); |
|
| 505 | + geodir_bestof_js(); |
|
| 506 | + $output = ob_get_contents(); |
|
| 507 | + ob_end_clean(); |
|
| 508 | + $this->assertContains('bestof-widget-tab-layout', $output); |
|
| 509 | + |
|
| 510 | + } |
|
| 511 | + |
|
| 512 | + public function testCptCatsWidget() { |
|
| 513 | + $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_cpt_categories_widget.php'; |
|
| 514 | + include_once($template); |
|
| 515 | + |
|
| 516 | + ob_start(); |
|
| 517 | + the_widget( 'geodir_cpt_categories_widget' ); |
|
| 518 | + $output = ob_get_contents(); |
|
| 519 | + ob_end_clean(); |
|
| 520 | + $this->assertContains('geodir_cpt_categories_widget', $output); |
|
| 521 | + |
|
| 522 | + ob_start(); |
|
| 523 | + $this->the_widget_form( 'geodir_cpt_categories_widget' ); |
|
| 524 | + $output = ob_get_contents(); |
|
| 525 | + ob_end_clean(); |
|
| 526 | + $this->assertContains('Select CPT', $output); |
|
| 527 | + |
|
| 528 | + $new_instance = array( |
|
| 529 | + 'title' => '', |
|
| 530 | + 'post_type' => array(), // NULL for all |
|
| 531 | + 'hide_empty' => '', |
|
| 532 | + 'show_count' => '', |
|
| 533 | + 'hide_icon' => '', |
|
| 534 | + 'cpt_left' => '', |
|
| 535 | + 'sort_by' => 'count', |
|
| 536 | + 'max_count' => 'all', |
|
| 537 | + 'max_level' => '1' |
|
| 538 | + ); |
|
| 539 | + $output = $this->the_widget_form_update( 'geodir_cpt_categories_widget', $new_instance ); |
|
| 540 | + $this->assertContains('count', $output['sort_by']); |
|
| 541 | + |
|
| 542 | + } |
|
| 543 | + |
|
| 544 | + public function testFeaturesWidget() { |
|
| 545 | + $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_features_widget.php'; |
|
| 546 | + include_once($template); |
|
| 547 | + |
|
| 548 | + $instance = array( |
|
| 549 | + 'title' => 'Features', |
|
| 550 | + 'icon_color' => '', |
|
| 551 | + 'title1' => 'Hello World', |
|
| 552 | + 'image1' => 'fa-recycle', |
|
| 553 | + 'desc1' => 'cool', |
|
| 554 | + ); |
|
| 555 | + |
|
| 556 | + ob_start(); |
|
| 557 | + the_widget( 'Geodir_Features_Widget', $instance); |
|
| 558 | + $output = ob_get_contents(); |
|
| 559 | + ob_end_clean(); |
|
| 560 | + $this->assertContains('widget_gd_features', $output); |
|
| 561 | + |
|
| 562 | + ob_start(); |
|
| 563 | + $this->the_widget_form( 'Geodir_Features_Widget', $instance ); |
|
| 564 | + $output = ob_get_contents(); |
|
| 565 | + ob_end_clean(); |
|
| 566 | + $this->assertContains('Font Awesome Icon Color', $output); |
|
| 567 | + |
|
| 568 | + $new_instance = array( |
|
| 569 | + 'title' => 'Features', |
|
| 570 | + 'icon_color' => '', |
|
| 571 | + 'title1' => 'Hello World', |
|
| 572 | + 'image1' => 'fa-recycle', |
|
| 573 | + 'desc1' => 'cool', |
|
| 574 | + ); |
|
| 575 | + $output = $this->the_widget_form_update( 'Geodir_Features_Widget', $new_instance ); |
|
| 576 | + $this->assertContains('Features', $output['title']); |
|
| 577 | + |
|
| 578 | + } |
|
| 579 | + |
|
| 580 | + public function testSliderWidget() { |
|
| 581 | + $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_listing_slider_widget.php'; |
|
| 582 | + include_once($template); |
|
| 583 | + |
|
| 584 | + ob_start(); |
|
| 585 | + the_widget( 'geodir_listing_slider_widget' ); |
|
| 586 | + $output = ob_get_contents(); |
|
| 587 | + ob_end_clean(); |
|
| 588 | + $this->assertContains('geodir_listing_slider_view', $output); |
|
| 589 | + |
|
| 590 | + ob_start(); |
|
| 591 | + $this->the_widget_form( 'geodir_listing_slider_widget' ); |
|
| 592 | + $output = ob_get_contents(); |
|
| 593 | + ob_end_clean(); |
|
| 594 | + $this->assertContains('Slide Show Speed', $output); |
|
| 595 | + |
|
| 596 | + $new_instance = array( |
|
| 597 | + 'title' => '', |
|
| 598 | + 'post_type' => '', |
|
| 599 | + 'category' => '', |
|
| 600 | + 'post_number' => '5', |
|
| 601 | + 'max_show' => '1', |
|
| 602 | + 'slide_width' => '', |
|
| 603 | + 'show_title' => '', |
|
| 604 | + 'slideshow' => '', |
|
| 605 | + 'animationLoop' => '', |
|
| 606 | + 'directionNav' => '', |
|
| 607 | + 'slideshowSpeed' => 5000, |
|
| 608 | + 'animationSpeed' => 600, |
|
| 609 | + 'animation' => '', |
|
| 610 | + 'list_sort' => 'latest', |
|
| 611 | + 'show_featured_only' => '', |
|
| 612 | + ); |
|
| 613 | + $output = $this->the_widget_form_update( 'geodir_listing_slider_widget', $new_instance ); |
|
| 614 | + $this->assertContains('latest', $output['list_sort']); |
|
| 615 | + |
|
| 616 | + } |
|
| 617 | + |
|
| 618 | + public function testPopularWidget() { |
|
| 619 | + $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_popular_widget.php'; |
|
| 620 | + include_once($template); |
|
| 621 | + |
|
| 622 | + ob_start(); |
|
| 623 | + the_widget( 'geodir_popular_post_category' ); |
|
| 624 | + $output = ob_get_contents(); |
|
| 625 | + ob_end_clean(); |
|
| 626 | + $this->assertContains('geodir_popular_post_category', $output); |
|
| 627 | + |
|
| 628 | + ob_start(); |
|
| 629 | + $this->the_widget_form( 'geodir_popular_post_category' ); |
|
| 630 | + $output = ob_get_contents(); |
|
| 631 | + ob_end_clean(); |
|
| 632 | + $this->assertContains('Default post type to use', $output); |
|
| 633 | + |
|
| 634 | + $new_instance = array( |
|
| 635 | + 'title' => '', |
|
| 636 | + 'category_limit' => 15, |
|
| 637 | + 'default_post_type' => '' |
|
| 638 | + ); |
|
| 639 | + $output = $this->the_widget_form_update( 'geodir_popular_post_category', $new_instance ); |
|
| 640 | + $this->assertEquals(15, $output['category_limit']); |
|
| 641 | + |
|
| 642 | + ob_start(); |
|
| 643 | + $instance = array(); |
|
| 644 | + $instance['category_title'] = ''; |
|
| 645 | + the_widget( 'geodir_popular_postview', $instance ); |
|
| 646 | + $output = ob_get_contents(); |
|
| 647 | + ob_end_clean(); |
|
| 648 | + $this->assertContains('geodir_popular_post_view', $output); |
|
| 649 | + |
|
| 650 | + ob_start(); |
|
| 651 | + $this->the_widget_form( 'geodir_popular_postview' ); |
|
| 652 | + $output = ob_get_contents(); |
|
| 653 | + ob_end_clean(); |
|
| 654 | + $this->assertContains('Post Category', $output); |
|
| 655 | + |
|
| 656 | + $new_instance = array( |
|
| 657 | + 'title' => '', |
|
| 658 | + 'post_type' => '', |
|
| 659 | + 'category' => array(), |
|
| 660 | + 'category_title' => '', |
|
| 661 | + 'list_sort' => '', |
|
| 662 | + 'list_order' => '', |
|
| 663 | + 'post_number' => '5', |
|
| 664 | + 'layout' => 'gridview_onehalf', |
|
| 665 | + 'listing_width' => '', |
|
| 666 | + 'add_location_filter' => '1', |
|
| 667 | + 'character_count' => '20', |
|
| 668 | + 'show_featured_only' => '', |
|
| 669 | + 'show_special_only' => '', |
|
| 670 | + 'with_pics_only' => '', |
|
| 671 | + 'with_videos_only' => '', |
|
| 672 | + 'use_viewing_post_type' => '' |
|
| 673 | + ); |
|
| 674 | + $output = $this->the_widget_form_update( 'geodir_popular_postview', $new_instance ); |
|
| 675 | + $this->assertContains('gridview_onehalf', $output['layout']); |
|
| 676 | + |
|
| 677 | + } |
|
| 678 | + |
|
| 679 | + public function testRelatedWidget() { |
|
| 680 | + $query_args = array( |
|
| 681 | + 'post_status' => 'publish', |
|
| 682 | + 'post_type' => 'gd_place', |
|
| 683 | + 'posts_per_page' => 1, |
|
| 684 | + ); |
|
| 685 | + |
|
| 686 | + $all_posts = new WP_Query( $query_args ); |
|
| 687 | + $post_id = null; |
|
| 688 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 689 | + global $post; |
|
| 690 | + $post_id = get_the_ID(); |
|
| 691 | + $post = geodir_get_post_info($post->ID); |
|
| 692 | 692 | |
| 693 | 693 | // $term_list = wp_get_post_terms($post->ID, 'gd_placecategory'); |
| 694 | 694 | // $post->gd_placecategory = (string) $term_list[0]->term_id; |
| 695 | 695 | |
| 696 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_related_listing_widget.php'; |
|
| 697 | - include_once($template); |
|
| 698 | - |
|
| 699 | - ob_start(); |
|
| 700 | - the_widget( 'geodir_related_listing_postview' ); |
|
| 701 | - $output = ob_get_contents(); |
|
| 702 | - ob_end_clean(); |
|
| 703 | - $this->assertContains('Related Listing', $output); |
|
| 704 | - |
|
| 705 | - ob_start(); |
|
| 706 | - $this->the_widget_form( 'geodir_related_listing_postview' ); |
|
| 707 | - $output = ob_get_contents(); |
|
| 708 | - ob_end_clean(); |
|
| 709 | - $this->assertContains('Relate to', $output); |
|
| 710 | - |
|
| 711 | - $new_instance = array( |
|
| 712 | - 'title' => '', |
|
| 713 | - 'list_sort' => '', |
|
| 714 | - 'list_order' => '', |
|
| 715 | - 'post_number' => '5', |
|
| 716 | - 'relate_to' => '', |
|
| 717 | - 'layout' => 'gridview_onehalf', |
|
| 718 | - 'listing_width' => '', |
|
| 719 | - 'add_location_filter' => '1', |
|
| 720 | - 'character_count' => '20' |
|
| 721 | - ); |
|
| 722 | - $output = $this->the_widget_form_update( 'geodir_related_listing_postview', $new_instance ); |
|
| 723 | - $this->assertContains('gridview_onehalf', $output['layout']); |
|
| 724 | - endwhile; |
|
| 725 | - |
|
| 726 | - $this->assertTrue(is_int($post_id)); |
|
| 727 | - |
|
| 728 | - |
|
| 729 | - } |
|
| 730 | - |
|
| 731 | - public function testReviewsWidget() { |
|
| 732 | - |
|
| 733 | - $time = current_time('mysql'); |
|
| 734 | - |
|
| 735 | - $args = array( |
|
| 736 | - 'listing_type' => 'gd_place', |
|
| 737 | - 'post_title' => 'Test Listing Title', |
|
| 738 | - 'post_desc' => 'Test Desc', |
|
| 739 | - 'post_tags' => 'test1,test2', |
|
| 740 | - 'post_address' => 'New York City Hall', |
|
| 741 | - 'post_zip' => '10007', |
|
| 742 | - 'post_latitude' => '40.7127837', |
|
| 743 | - 'post_longitude' => '-74.00594130000002', |
|
| 744 | - 'post_mapview' => 'ROADMAP', |
|
| 745 | - 'post_mapzoom' => '10', |
|
| 746 | - 'geodir_timing' => '10.00 am to 6 pm every day', |
|
| 747 | - 'geodir_contact' => '1234567890', |
|
| 748 | - 'geodir_email' => '[email protected]', |
|
| 749 | - 'geodir_website' => 'http://test.com', |
|
| 750 | - 'geodir_twitter' => 'http://twitter.com/test', |
|
| 751 | - 'geodir_facebook' => 'http://facebook.com/test', |
|
| 752 | - 'geodir_special_offers' => 'Test offer' |
|
| 753 | - ); |
|
| 754 | - $post_id = geodir_save_listing($args, true); |
|
| 755 | - |
|
| 756 | - $data = array( |
|
| 757 | - 'comment_post_ID' => $post_id, |
|
| 758 | - 'comment_author' => 'admin', |
|
| 759 | - 'comment_author_email' => '[email protected]', |
|
| 760 | - 'comment_author_url' => 'http://wpgeodirectory.com', |
|
| 761 | - 'comment_content' => 'content here', |
|
| 762 | - 'comment_type' => '', |
|
| 763 | - 'comment_parent' => 0, |
|
| 764 | - 'user_id' => 1, |
|
| 765 | - 'comment_author_IP' => '127.0.0.1', |
|
| 766 | - '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)', |
|
| 767 | - 'comment_date' => $time, |
|
| 768 | - 'comment_approved' => 1, |
|
| 769 | - ); |
|
| 770 | - |
|
| 771 | - $comment_id = wp_insert_comment($data); |
|
| 772 | - |
|
| 773 | - $_REQUEST['geodir_overallrating'] = 5.0; |
|
| 774 | - geodir_save_rating($comment_id); |
|
| 775 | - |
|
| 776 | - $this->assertTrue(is_int($comment_id)); |
|
| 777 | - |
|
| 778 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_reviews_widget.php'; |
|
| 779 | - include_once($template); |
|
| 780 | - |
|
| 781 | - ob_start(); |
|
| 782 | - the_widget( 'geodir_recent_reviews_widget' ); |
|
| 783 | - $output = ob_get_contents(); |
|
| 784 | - ob_end_clean(); |
|
| 785 | - $this->assertContains('geodir_recent_reviews', $output); |
|
| 786 | - |
|
| 787 | - ob_start(); |
|
| 788 | - $this->the_widget_form( 'geodir_recent_reviews_widget' ); |
|
| 789 | - $output = ob_get_contents(); |
|
| 790 | - ob_end_clean(); |
|
| 791 | - $this->assertContains('Number of Reviews', $output); |
|
| 792 | - |
|
| 793 | - $new_instance = array( |
|
| 794 | - 'title' => '', |
|
| 795 | - 't1' => '', |
|
| 796 | - 't2' => '', |
|
| 797 | - 't3' => '', |
|
| 798 | - 'img1' => '', |
|
| 799 | - 'count' => '' |
|
| 800 | - ); |
|
| 801 | - $output = $this->the_widget_form_update( 'geodir_recent_reviews_widget', $new_instance ); |
|
| 802 | - $this->assertTrue(empty($output['count'])); |
|
| 803 | - } |
|
| 804 | - |
|
| 805 | - public function testHomeMapWidget() { |
|
| 806 | - $template = geodir_plugin_path() . '/geodirectory-widgets/home_map_widget.php'; |
|
| 807 | - include_once($template); |
|
| 808 | - |
|
| 809 | - ob_start(); |
|
| 810 | - $instance = array(); |
|
| 811 | - $args = array(); |
|
| 812 | - $args["widget_id"] = "geodir_map_v3_home_map-2"; |
|
| 813 | - the_widget( 'geodir_homepage_map', $instance, $args ); |
|
| 814 | - $output = ob_get_contents(); |
|
| 815 | - ob_end_clean(); |
|
| 816 | - $this->assertContains('geodir-map-home-page', $output); |
|
| 817 | - |
|
| 818 | - ob_start(); |
|
| 819 | - $this->the_widget_form( 'geodir_homepage_map' ); |
|
| 820 | - $output = ob_get_contents(); |
|
| 821 | - ob_end_clean(); |
|
| 822 | - $this->assertContains('Map Zoom level', $output); |
|
| 823 | - |
|
| 824 | - $new_instance = array( |
|
| 825 | - 'width' => '', |
|
| 826 | - 'heigh' => '', |
|
| 827 | - 'maptype' => '', |
|
| 828 | - 'zoom' => '', |
|
| 829 | - 'autozoom' => '', |
|
| 830 | - 'child_collapse' => '0', |
|
| 831 | - 'scrollwheel' => '0' |
|
| 832 | - ); |
|
| 833 | - $output = $this->the_widget_form_update( 'geodir_homepage_map', $new_instance ); |
|
| 834 | - $this->assertContains('0', $output['scrollwheel']); |
|
| 835 | - |
|
| 836 | - } |
|
| 837 | - |
|
| 838 | - public function testLoginWidget() { |
|
| 839 | - |
|
| 840 | - register_geodir_widgets(); |
|
| 841 | - |
|
| 842 | - ob_start(); |
|
| 843 | - the_widget( 'geodir_loginwidget' ); |
|
| 844 | - $output = ob_get_contents(); |
|
| 845 | - ob_end_clean(); |
|
| 846 | - $this->assertContains('geodir_loginbox', $output); |
|
| 847 | - |
|
| 848 | - ob_start(); |
|
| 849 | - $this->the_widget_form( 'geodir_loginwidget' ); |
|
| 850 | - $output = ob_get_contents(); |
|
| 851 | - ob_end_clean(); |
|
| 852 | - $this->assertContains('Widget Title', $output); |
|
| 853 | - |
|
| 854 | - $new_instance = array( |
|
| 855 | - 'title' => 'Login', |
|
| 856 | - 't1' => '', |
|
| 857 | - 't2' => '', |
|
| 858 | - 't3' => '', |
|
| 859 | - 'img1' => '', |
|
| 860 | - 'desc1' => '' |
|
| 861 | - ); |
|
| 862 | - $output = $this->the_widget_form_update( 'geodir_loginwidget', $new_instance ); |
|
| 863 | - $this->assertContains('Login', $output['title']); |
|
| 864 | - |
|
| 865 | - } |
|
| 866 | - |
|
| 867 | - public function testSocialWidget() { |
|
| 868 | - |
|
| 869 | - ob_start(); |
|
| 870 | - the_widget( 'geodir_social_like_widget' ); |
|
| 871 | - $output = ob_get_contents(); |
|
| 872 | - ob_end_clean(); |
|
| 873 | - $this->assertContains('twitter.com', $output); |
|
| 874 | - |
|
| 875 | - ob_start(); |
|
| 876 | - $this->the_widget_form( 'geodir_social_like_widget' ); |
|
| 877 | - $output = ob_get_contents(); |
|
| 878 | - ob_end_clean(); |
|
| 879 | - $this->assertContains('No settings for this widget', $output); |
|
| 880 | - |
|
| 881 | - $new_instance = array( |
|
| 882 | - 'title' => 'Social', |
|
| 883 | - ); |
|
| 884 | - $output = $this->the_widget_form_update( 'geodir_social_like_widget', $new_instance ); |
|
| 885 | - $this->assertContains('Social', $output['title']); |
|
| 886 | - |
|
| 887 | - } |
|
| 888 | - |
|
| 889 | - public function testSubscribeWidget() { |
|
| 890 | - |
|
| 891 | - ob_start(); |
|
| 892 | - the_widget( 'geodirsubscribeWidget' ); |
|
| 893 | - $output = ob_get_contents(); |
|
| 894 | - ob_end_clean(); |
|
| 895 | - $this->assertContains('geodir-subscribe-form', $output); |
|
| 896 | - |
|
| 897 | - ob_start(); |
|
| 898 | - $this->the_widget_form( 'geodirsubscribeWidget' ); |
|
| 899 | - $output = ob_get_contents(); |
|
| 900 | - ob_end_clean(); |
|
| 901 | - $this->assertContains('Feedburner ID', $output); |
|
| 902 | - |
|
| 903 | - $new_instance = array( |
|
| 904 | - 'title' => 'Subscribe', |
|
| 905 | - 'id' => '', |
|
| 906 | - 'advt1' => '', |
|
| 907 | - 'text' => '', |
|
| 908 | - 'twitter' => '', |
|
| 909 | - 'facebook' => '', |
|
| 910 | - 'digg' => '', |
|
| 911 | - 'myspace' => '' |
|
| 912 | - ); |
|
| 913 | - $output = $this->the_widget_form_update( 'geodirsubscribeWidget', $new_instance ); |
|
| 914 | - $this->assertContains('Subscribe', $output['title']); |
|
| 915 | - |
|
| 916 | - } |
|
| 917 | - |
|
| 918 | - public function testAdvWidget() { |
|
| 919 | - |
|
| 920 | - ob_start(); |
|
| 921 | - $instance = array(); |
|
| 922 | - $instance['desc1'] = 'hello'; |
|
| 923 | - the_widget( 'geodiradvtwidget', $instance ); |
|
| 924 | - $output = ob_get_contents(); |
|
| 925 | - ob_end_clean(); |
|
| 926 | - $this->assertContains('hello', $output); |
|
| 927 | - |
|
| 928 | - ob_start(); |
|
| 929 | - $this->the_widget_form( 'geodiradvtwidget' ); |
|
| 930 | - $output = ob_get_contents(); |
|
| 931 | - ob_end_clean(); |
|
| 932 | - $this->assertContains('Your Advt code', $output); |
|
| 933 | - |
|
| 934 | - $new_instance = array( |
|
| 935 | - 'desc1' => 'Advertise' |
|
| 936 | - ); |
|
| 937 | - $output = $this->the_widget_form_update( 'geodiradvtwidget', $new_instance ); |
|
| 938 | - $this->assertContains('Advertise', $output['desc1']); |
|
| 939 | - |
|
| 940 | - } |
|
| 941 | - |
|
| 942 | - public function testFlickrWidget() { |
|
| 943 | - |
|
| 944 | - ob_start(); |
|
| 945 | - the_widget( 'GeodirFlickrWidget' ); |
|
| 946 | - $output = ob_get_contents(); |
|
| 947 | - ob_end_clean(); |
|
| 948 | - $this->assertContains('geodir-flickr', $output); |
|
| 949 | - |
|
| 950 | - ob_start(); |
|
| 951 | - $this->the_widget_form( 'GeodirFlickrWidget' ); |
|
| 952 | - $output = ob_get_contents(); |
|
| 953 | - ob_end_clean(); |
|
| 954 | - $this->assertContains('Flickr ID', $output); |
|
| 955 | - |
|
| 956 | - $new_instance = array( |
|
| 957 | - 'id' => '', |
|
| 958 | - 'number' => '34' |
|
| 959 | - ); |
|
| 960 | - $output = $this->the_widget_form_update( 'GeodirFlickrWidget', $new_instance ); |
|
| 961 | - $this->assertContains('34', $output['number']); |
|
| 962 | - |
|
| 963 | - } |
|
| 964 | - |
|
| 965 | - public function testTwitterWidget() { |
|
| 966 | - |
|
| 967 | - ob_start(); |
|
| 968 | - $instance = array(); |
|
| 969 | - $instance['gd_tw_desc1'] = 'hello'; |
|
| 970 | - the_widget( 'geodir_twitter', $instance ); |
|
| 971 | - $output = ob_get_contents(); |
|
| 972 | - ob_end_clean(); |
|
| 973 | - $this->assertContains('hello', $output); |
|
| 974 | - |
|
| 975 | - ob_start(); |
|
| 976 | - $this->the_widget_form( 'geodir_twitter' ); |
|
| 977 | - $output = ob_get_contents(); |
|
| 978 | - ob_end_clean(); |
|
| 979 | - $this->assertContains('Your twitter code', $output); |
|
| 980 | - |
|
| 981 | - $new_instance = array( |
|
| 982 | - 'gd_tw_desc1' => 'hello' |
|
| 983 | - ); |
|
| 984 | - $output = $this->the_widget_form_update( 'geodir_twitter', $new_instance ); |
|
| 985 | - $this->assertContains('hello', $output['gd_tw_desc1']); |
|
| 986 | - |
|
| 987 | - } |
|
| 988 | - |
|
| 989 | - public function testAdvSearchWidget() { |
|
| 990 | - |
|
| 991 | - ob_start(); |
|
| 992 | - the_widget( 'geodir_advance_search_widget' ); |
|
| 993 | - $output = ob_get_contents(); |
|
| 994 | - ob_end_clean(); |
|
| 995 | - $this->assertContains('geodir-loc-bar', $output); |
|
| 996 | - |
|
| 997 | - ob_start(); |
|
| 998 | - $this->the_widget_form( 'geodir_advance_search_widget' ); |
|
| 999 | - $output = ob_get_contents(); |
|
| 1000 | - ob_end_clean(); |
|
| 1001 | - $this->assertContains('This is a search widget', $output); |
|
| 696 | + $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_related_listing_widget.php'; |
|
| 697 | + include_once($template); |
|
| 698 | + |
|
| 699 | + ob_start(); |
|
| 700 | + the_widget( 'geodir_related_listing_postview' ); |
|
| 701 | + $output = ob_get_contents(); |
|
| 702 | + ob_end_clean(); |
|
| 703 | + $this->assertContains('Related Listing', $output); |
|
| 704 | + |
|
| 705 | + ob_start(); |
|
| 706 | + $this->the_widget_form( 'geodir_related_listing_postview' ); |
|
| 707 | + $output = ob_get_contents(); |
|
| 708 | + ob_end_clean(); |
|
| 709 | + $this->assertContains('Relate to', $output); |
|
| 710 | + |
|
| 711 | + $new_instance = array( |
|
| 712 | + 'title' => '', |
|
| 713 | + 'list_sort' => '', |
|
| 714 | + 'list_order' => '', |
|
| 715 | + 'post_number' => '5', |
|
| 716 | + 'relate_to' => '', |
|
| 717 | + 'layout' => 'gridview_onehalf', |
|
| 718 | + 'listing_width' => '', |
|
| 719 | + 'add_location_filter' => '1', |
|
| 720 | + 'character_count' => '20' |
|
| 721 | + ); |
|
| 722 | + $output = $this->the_widget_form_update( 'geodir_related_listing_postview', $new_instance ); |
|
| 723 | + $this->assertContains('gridview_onehalf', $output['layout']); |
|
| 724 | + endwhile; |
|
| 725 | + |
|
| 726 | + $this->assertTrue(is_int($post_id)); |
|
| 727 | + |
|
| 728 | + |
|
| 729 | + } |
|
| 730 | + |
|
| 731 | + public function testReviewsWidget() { |
|
| 732 | + |
|
| 733 | + $time = current_time('mysql'); |
|
| 734 | + |
|
| 735 | + $args = array( |
|
| 736 | + 'listing_type' => 'gd_place', |
|
| 737 | + 'post_title' => 'Test Listing Title', |
|
| 738 | + 'post_desc' => 'Test Desc', |
|
| 739 | + 'post_tags' => 'test1,test2', |
|
| 740 | + 'post_address' => 'New York City Hall', |
|
| 741 | + 'post_zip' => '10007', |
|
| 742 | + 'post_latitude' => '40.7127837', |
|
| 743 | + 'post_longitude' => '-74.00594130000002', |
|
| 744 | + 'post_mapview' => 'ROADMAP', |
|
| 745 | + 'post_mapzoom' => '10', |
|
| 746 | + 'geodir_timing' => '10.00 am to 6 pm every day', |
|
| 747 | + 'geodir_contact' => '1234567890', |
|
| 748 | + 'geodir_email' => '[email protected]', |
|
| 749 | + 'geodir_website' => 'http://test.com', |
|
| 750 | + 'geodir_twitter' => 'http://twitter.com/test', |
|
| 751 | + 'geodir_facebook' => 'http://facebook.com/test', |
|
| 752 | + 'geodir_special_offers' => 'Test offer' |
|
| 753 | + ); |
|
| 754 | + $post_id = geodir_save_listing($args, true); |
|
| 755 | + |
|
| 756 | + $data = array( |
|
| 757 | + 'comment_post_ID' => $post_id, |
|
| 758 | + 'comment_author' => 'admin', |
|
| 759 | + 'comment_author_email' => '[email protected]', |
|
| 760 | + 'comment_author_url' => 'http://wpgeodirectory.com', |
|
| 761 | + 'comment_content' => 'content here', |
|
| 762 | + 'comment_type' => '', |
|
| 763 | + 'comment_parent' => 0, |
|
| 764 | + 'user_id' => 1, |
|
| 765 | + 'comment_author_IP' => '127.0.0.1', |
|
| 766 | + '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)', |
|
| 767 | + 'comment_date' => $time, |
|
| 768 | + 'comment_approved' => 1, |
|
| 769 | + ); |
|
| 770 | + |
|
| 771 | + $comment_id = wp_insert_comment($data); |
|
| 772 | + |
|
| 773 | + $_REQUEST['geodir_overallrating'] = 5.0; |
|
| 774 | + geodir_save_rating($comment_id); |
|
| 775 | + |
|
| 776 | + $this->assertTrue(is_int($comment_id)); |
|
| 777 | + |
|
| 778 | + $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_reviews_widget.php'; |
|
| 779 | + include_once($template); |
|
| 780 | + |
|
| 781 | + ob_start(); |
|
| 782 | + the_widget( 'geodir_recent_reviews_widget' ); |
|
| 783 | + $output = ob_get_contents(); |
|
| 784 | + ob_end_clean(); |
|
| 785 | + $this->assertContains('geodir_recent_reviews', $output); |
|
| 786 | + |
|
| 787 | + ob_start(); |
|
| 788 | + $this->the_widget_form( 'geodir_recent_reviews_widget' ); |
|
| 789 | + $output = ob_get_contents(); |
|
| 790 | + ob_end_clean(); |
|
| 791 | + $this->assertContains('Number of Reviews', $output); |
|
| 792 | + |
|
| 793 | + $new_instance = array( |
|
| 794 | + 'title' => '', |
|
| 795 | + 't1' => '', |
|
| 796 | + 't2' => '', |
|
| 797 | + 't3' => '', |
|
| 798 | + 'img1' => '', |
|
| 799 | + 'count' => '' |
|
| 800 | + ); |
|
| 801 | + $output = $this->the_widget_form_update( 'geodir_recent_reviews_widget', $new_instance ); |
|
| 802 | + $this->assertTrue(empty($output['count'])); |
|
| 803 | + } |
|
| 804 | + |
|
| 805 | + public function testHomeMapWidget() { |
|
| 806 | + $template = geodir_plugin_path() . '/geodirectory-widgets/home_map_widget.php'; |
|
| 807 | + include_once($template); |
|
| 808 | + |
|
| 809 | + ob_start(); |
|
| 810 | + $instance = array(); |
|
| 811 | + $args = array(); |
|
| 812 | + $args["widget_id"] = "geodir_map_v3_home_map-2"; |
|
| 813 | + the_widget( 'geodir_homepage_map', $instance, $args ); |
|
| 814 | + $output = ob_get_contents(); |
|
| 815 | + ob_end_clean(); |
|
| 816 | + $this->assertContains('geodir-map-home-page', $output); |
|
| 817 | + |
|
| 818 | + ob_start(); |
|
| 819 | + $this->the_widget_form( 'geodir_homepage_map' ); |
|
| 820 | + $output = ob_get_contents(); |
|
| 821 | + ob_end_clean(); |
|
| 822 | + $this->assertContains('Map Zoom level', $output); |
|
| 823 | + |
|
| 824 | + $new_instance = array( |
|
| 825 | + 'width' => '', |
|
| 826 | + 'heigh' => '', |
|
| 827 | + 'maptype' => '', |
|
| 828 | + 'zoom' => '', |
|
| 829 | + 'autozoom' => '', |
|
| 830 | + 'child_collapse' => '0', |
|
| 831 | + 'scrollwheel' => '0' |
|
| 832 | + ); |
|
| 833 | + $output = $this->the_widget_form_update( 'geodir_homepage_map', $new_instance ); |
|
| 834 | + $this->assertContains('0', $output['scrollwheel']); |
|
| 835 | + |
|
| 836 | + } |
|
| 837 | + |
|
| 838 | + public function testLoginWidget() { |
|
| 839 | + |
|
| 840 | + register_geodir_widgets(); |
|
| 841 | + |
|
| 842 | + ob_start(); |
|
| 843 | + the_widget( 'geodir_loginwidget' ); |
|
| 844 | + $output = ob_get_contents(); |
|
| 845 | + ob_end_clean(); |
|
| 846 | + $this->assertContains('geodir_loginbox', $output); |
|
| 847 | + |
|
| 848 | + ob_start(); |
|
| 849 | + $this->the_widget_form( 'geodir_loginwidget' ); |
|
| 850 | + $output = ob_get_contents(); |
|
| 851 | + ob_end_clean(); |
|
| 852 | + $this->assertContains('Widget Title', $output); |
|
| 853 | + |
|
| 854 | + $new_instance = array( |
|
| 855 | + 'title' => 'Login', |
|
| 856 | + 't1' => '', |
|
| 857 | + 't2' => '', |
|
| 858 | + 't3' => '', |
|
| 859 | + 'img1' => '', |
|
| 860 | + 'desc1' => '' |
|
| 861 | + ); |
|
| 862 | + $output = $this->the_widget_form_update( 'geodir_loginwidget', $new_instance ); |
|
| 863 | + $this->assertContains('Login', $output['title']); |
|
| 864 | + |
|
| 865 | + } |
|
| 866 | + |
|
| 867 | + public function testSocialWidget() { |
|
| 868 | + |
|
| 869 | + ob_start(); |
|
| 870 | + the_widget( 'geodir_social_like_widget' ); |
|
| 871 | + $output = ob_get_contents(); |
|
| 872 | + ob_end_clean(); |
|
| 873 | + $this->assertContains('twitter.com', $output); |
|
| 874 | + |
|
| 875 | + ob_start(); |
|
| 876 | + $this->the_widget_form( 'geodir_social_like_widget' ); |
|
| 877 | + $output = ob_get_contents(); |
|
| 878 | + ob_end_clean(); |
|
| 879 | + $this->assertContains('No settings for this widget', $output); |
|
| 880 | + |
|
| 881 | + $new_instance = array( |
|
| 882 | + 'title' => 'Social', |
|
| 883 | + ); |
|
| 884 | + $output = $this->the_widget_form_update( 'geodir_social_like_widget', $new_instance ); |
|
| 885 | + $this->assertContains('Social', $output['title']); |
|
| 886 | + |
|
| 887 | + } |
|
| 888 | + |
|
| 889 | + public function testSubscribeWidget() { |
|
| 890 | + |
|
| 891 | + ob_start(); |
|
| 892 | + the_widget( 'geodirsubscribeWidget' ); |
|
| 893 | + $output = ob_get_contents(); |
|
| 894 | + ob_end_clean(); |
|
| 895 | + $this->assertContains('geodir-subscribe-form', $output); |
|
| 896 | + |
|
| 897 | + ob_start(); |
|
| 898 | + $this->the_widget_form( 'geodirsubscribeWidget' ); |
|
| 899 | + $output = ob_get_contents(); |
|
| 900 | + ob_end_clean(); |
|
| 901 | + $this->assertContains('Feedburner ID', $output); |
|
| 902 | + |
|
| 903 | + $new_instance = array( |
|
| 904 | + 'title' => 'Subscribe', |
|
| 905 | + 'id' => '', |
|
| 906 | + 'advt1' => '', |
|
| 907 | + 'text' => '', |
|
| 908 | + 'twitter' => '', |
|
| 909 | + 'facebook' => '', |
|
| 910 | + 'digg' => '', |
|
| 911 | + 'myspace' => '' |
|
| 912 | + ); |
|
| 913 | + $output = $this->the_widget_form_update( 'geodirsubscribeWidget', $new_instance ); |
|
| 914 | + $this->assertContains('Subscribe', $output['title']); |
|
| 915 | + |
|
| 916 | + } |
|
| 917 | + |
|
| 918 | + public function testAdvWidget() { |
|
| 919 | + |
|
| 920 | + ob_start(); |
|
| 921 | + $instance = array(); |
|
| 922 | + $instance['desc1'] = 'hello'; |
|
| 923 | + the_widget( 'geodiradvtwidget', $instance ); |
|
| 924 | + $output = ob_get_contents(); |
|
| 925 | + ob_end_clean(); |
|
| 926 | + $this->assertContains('hello', $output); |
|
| 927 | + |
|
| 928 | + ob_start(); |
|
| 929 | + $this->the_widget_form( 'geodiradvtwidget' ); |
|
| 930 | + $output = ob_get_contents(); |
|
| 931 | + ob_end_clean(); |
|
| 932 | + $this->assertContains('Your Advt code', $output); |
|
| 933 | + |
|
| 934 | + $new_instance = array( |
|
| 935 | + 'desc1' => 'Advertise' |
|
| 936 | + ); |
|
| 937 | + $output = $this->the_widget_form_update( 'geodiradvtwidget', $new_instance ); |
|
| 938 | + $this->assertContains('Advertise', $output['desc1']); |
|
| 939 | + |
|
| 940 | + } |
|
| 941 | + |
|
| 942 | + public function testFlickrWidget() { |
|
| 943 | + |
|
| 944 | + ob_start(); |
|
| 945 | + the_widget( 'GeodirFlickrWidget' ); |
|
| 946 | + $output = ob_get_contents(); |
|
| 947 | + ob_end_clean(); |
|
| 948 | + $this->assertContains('geodir-flickr', $output); |
|
| 949 | + |
|
| 950 | + ob_start(); |
|
| 951 | + $this->the_widget_form( 'GeodirFlickrWidget' ); |
|
| 952 | + $output = ob_get_contents(); |
|
| 953 | + ob_end_clean(); |
|
| 954 | + $this->assertContains('Flickr ID', $output); |
|
| 955 | + |
|
| 956 | + $new_instance = array( |
|
| 957 | + 'id' => '', |
|
| 958 | + 'number' => '34' |
|
| 959 | + ); |
|
| 960 | + $output = $this->the_widget_form_update( 'GeodirFlickrWidget', $new_instance ); |
|
| 961 | + $this->assertContains('34', $output['number']); |
|
| 962 | + |
|
| 963 | + } |
|
| 964 | + |
|
| 965 | + public function testTwitterWidget() { |
|
| 966 | + |
|
| 967 | + ob_start(); |
|
| 968 | + $instance = array(); |
|
| 969 | + $instance['gd_tw_desc1'] = 'hello'; |
|
| 970 | + the_widget( 'geodir_twitter', $instance ); |
|
| 971 | + $output = ob_get_contents(); |
|
| 972 | + ob_end_clean(); |
|
| 973 | + $this->assertContains('hello', $output); |
|
| 974 | + |
|
| 975 | + ob_start(); |
|
| 976 | + $this->the_widget_form( 'geodir_twitter' ); |
|
| 977 | + $output = ob_get_contents(); |
|
| 978 | + ob_end_clean(); |
|
| 979 | + $this->assertContains('Your twitter code', $output); |
|
| 980 | + |
|
| 981 | + $new_instance = array( |
|
| 982 | + 'gd_tw_desc1' => 'hello' |
|
| 983 | + ); |
|
| 984 | + $output = $this->the_widget_form_update( 'geodir_twitter', $new_instance ); |
|
| 985 | + $this->assertContains('hello', $output['gd_tw_desc1']); |
|
| 986 | + |
|
| 987 | + } |
|
| 988 | + |
|
| 989 | + public function testAdvSearchWidget() { |
|
| 990 | + |
|
| 991 | + ob_start(); |
|
| 992 | + the_widget( 'geodir_advance_search_widget' ); |
|
| 993 | + $output = ob_get_contents(); |
|
| 994 | + ob_end_clean(); |
|
| 995 | + $this->assertContains('geodir-loc-bar', $output); |
|
| 996 | + |
|
| 997 | + ob_start(); |
|
| 998 | + $this->the_widget_form( 'geodir_advance_search_widget' ); |
|
| 999 | + $output = ob_get_contents(); |
|
| 1000 | + ob_end_clean(); |
|
| 1001 | + $this->assertContains('This is a search widget', $output); |
|
| 1002 | 1002 | |
| 1003 | 1003 | // $new_instance = array( |
| 1004 | 1004 | // ); |
| 1005 | 1005 | // $output = $this->the_widget_form_update( 'geodir_advance_search_widget', $new_instance ); |
| 1006 | 1006 | // $this->assertContains('Subscribe', $output['title']); |
| 1007 | 1007 | |
| 1008 | - } |
|
| 1009 | - |
|
| 1010 | - public function testListingMapWidget() { |
|
| 1011 | - |
|
| 1012 | - $template = geodir_plugin_path() . '/geodirectory-widgets/listing_map_widget.php'; |
|
| 1013 | - include_once($template); |
|
| 1014 | - |
|
| 1015 | - //listing page |
|
| 1016 | - $this->go_to( home_url('/?post_type=gd_place') ); |
|
| 1017 | - |
|
| 1018 | - ob_start(); |
|
| 1019 | - $instance = array(); |
|
| 1020 | - $args = array(); |
|
| 1021 | - $args["widget_id"] = "geodir_map_v3_listing_map-2"; |
|
| 1022 | - the_widget( 'geodir_map_listingpage', $instance, $args ); |
|
| 1023 | - $output = ob_get_contents(); |
|
| 1024 | - ob_end_clean(); |
|
| 1025 | - $this->assertContains('geodir-map-listing-page', $output); |
|
| 1026 | - |
|
| 1027 | - // detail page |
|
| 1028 | - $query_args = array( |
|
| 1029 | - 'post_status' => 'publish', |
|
| 1030 | - 'post_type' => 'gd_place', |
|
| 1031 | - 'posts_per_page' => 1, |
|
| 1032 | - ); |
|
| 1033 | - |
|
| 1034 | - $all_posts = new WP_Query( $query_args ); |
|
| 1035 | - $post_id = null; |
|
| 1036 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 1037 | - $post_id = get_the_ID(); |
|
| 1038 | - endwhile; |
|
| 1039 | - |
|
| 1040 | - $this->assertTrue(is_int($post_id)); |
|
| 1041 | - |
|
| 1042 | - $this->go_to( get_permalink($post_id) ); |
|
| 1043 | - |
|
| 1044 | - ob_start(); |
|
| 1045 | - $instance = array(); |
|
| 1046 | - $args = array(); |
|
| 1047 | - $args["widget_id"] = "geodir_map_v3_listing_map-2"; |
|
| 1048 | - the_widget( 'geodir_map_listingpage', $instance, $args ); |
|
| 1049 | - $output = ob_get_contents(); |
|
| 1050 | - ob_end_clean(); |
|
| 1051 | - $this->assertContains('geodir-map-listing-page', $output); |
|
| 1052 | - |
|
| 1053 | - ob_start(); |
|
| 1054 | - $this->the_widget_form( 'geodir_map_listingpage' ); |
|
| 1055 | - $output = ob_get_contents(); |
|
| 1056 | - ob_end_clean(); |
|
| 1057 | - $this->assertContains('Select Map View', $output); |
|
| 1058 | - |
|
| 1059 | - $new_instance = array( |
|
| 1060 | - 'width' => '', |
|
| 1061 | - 'heigh' => '', |
|
| 1062 | - 'maptype' => '', |
|
| 1063 | - 'zoom' => '', |
|
| 1064 | - 'autozoom' => '', |
|
| 1065 | - 'sticky' => '', |
|
| 1066 | - 'scrollwheel' => '0', |
|
| 1067 | - 'showall' => '0' |
|
| 1068 | - ); |
|
| 1069 | - $output = $this->the_widget_form_update( 'geodir_map_listingpage', $new_instance ); |
|
| 1070 | - $this->assertContains('0', $output['scrollwheel']); |
|
| 1071 | - |
|
| 1072 | - |
|
| 1073 | - } |
|
| 1074 | - |
|
| 1075 | - private function load_template() { |
|
| 1076 | - do_action( 'template_redirect' ); |
|
| 1077 | - $template = false; |
|
| 1078 | - if ( is_404() && $template = get_404_template() ) : |
|
| 1079 | - elseif ( is_search() && $template = get_search_template() ) : |
|
| 1080 | - elseif ( is_front_page() && $template = get_front_page_template() ) : |
|
| 1081 | - elseif ( is_home() && $template = get_home_template() ) : |
|
| 1082 | - elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) : |
|
| 1083 | - elseif ( is_tax() && $template = get_taxonomy_template() ) : |
|
| 1084 | - elseif ( is_attachment() && $template = get_attachment_template() ) : |
|
| 1085 | - remove_filter('the_content', 'prepend_attachment'); |
|
| 1086 | - elseif ( is_single() && $template = get_single_template() ) : |
|
| 1087 | - elseif ( is_page() && $template = get_page_template() ) : |
|
| 1088 | - elseif ( is_category() && $template = get_category_template() ) : |
|
| 1089 | - elseif ( is_tag() && $template = get_tag_template() ) : |
|
| 1090 | - elseif ( is_author() && $template = get_author_template() ) : |
|
| 1091 | - elseif ( is_date() && $template = get_date_template() ) : |
|
| 1092 | - elseif ( is_archive() && $template = get_archive_template() ) : |
|
| 1093 | - elseif ( is_paged() && $template = get_paged_template() ) : |
|
| 1094 | - else : |
|
| 1095 | - $template = get_index_template(); |
|
| 1096 | - endif; |
|
| 1097 | - /** |
|
| 1098 | - * Filter the path of the current template before including it. |
|
| 1099 | - * |
|
| 1100 | - * @since 3.0.0 |
|
| 1101 | - * |
|
| 1102 | - * @param string $template The path of the template to include. |
|
| 1103 | - */ |
|
| 1104 | - if ( $template = apply_filters( 'template_include', $template ) ) { |
|
| 1105 | - $template_contents = file_get_contents( $template ); |
|
| 1106 | - $included_header = $included_footer = false; |
|
| 1107 | - if ( false !== stripos( $template_contents, 'get_header();' ) ) { |
|
| 1108 | - do_action( 'get_header', null ); |
|
| 1109 | - locate_template( 'header.php', true, false ); |
|
| 1110 | - $included_header = true; |
|
| 1111 | - } |
|
| 1112 | - include( $template ); |
|
| 1113 | - if ( false !== stripos( $template_contents, 'get_footer();' ) ) { |
|
| 1114 | - do_action( 'get_footer', null ); |
|
| 1115 | - locate_template( 'footer.php', true, false ); |
|
| 1116 | - $included_footer = true; |
|
| 1117 | - } |
|
| 1118 | - if ( $included_header && $included_footer ) { |
|
| 1119 | - global $wp_scripts; |
|
| 1120 | - $wp_scripts->done = array(); |
|
| 1121 | - } |
|
| 1122 | - } |
|
| 1123 | - return; |
|
| 1124 | - } |
|
| 1125 | - |
|
| 1126 | - public static function setPermalinkStructure( $struc = '/%postname%/' ) { |
|
| 1127 | - global $wp_rewrite; |
|
| 1128 | - $wp_rewrite->set_permalink_structure( $struc ); |
|
| 1129 | - $wp_rewrite->flush_rules(); |
|
| 1130 | - update_option( 'permalink_structure', $struc ); |
|
| 1131 | - flush_rewrite_rules( true ); |
|
| 1132 | - } |
|
| 1133 | - |
|
| 1134 | - function the_widget_form( $widget, $instance = array() ) { |
|
| 1135 | - global $wp_widget_factory; |
|
| 1136 | - |
|
| 1137 | - $widget_obj = $wp_widget_factory->widgets[$widget]; |
|
| 1138 | - if ( ! ( $widget_obj instanceof WP_Widget ) ) { |
|
| 1139 | - return; |
|
| 1140 | - } |
|
| 1141 | - |
|
| 1142 | - $widget_obj->_set(-1); |
|
| 1143 | - $widget_obj->form($instance); |
|
| 1144 | - } |
|
| 1145 | - |
|
| 1146 | - function the_widget_form_update( $widget, $new_instance = array(), $old_instance = array() ) { |
|
| 1147 | - global $wp_widget_factory; |
|
| 1148 | - |
|
| 1149 | - $widget_obj = $wp_widget_factory->widgets[$widget]; |
|
| 1150 | - if ( ! ( $widget_obj instanceof WP_Widget ) ) { |
|
| 1151 | - return; |
|
| 1152 | - } |
|
| 1153 | - |
|
| 1154 | - $widget_obj->_set(-1); |
|
| 1155 | - return $widget_obj->update($new_instance, $old_instance); |
|
| 1156 | - } |
|
| 1157 | - |
|
| 1158 | - |
|
| 1159 | - public function tearDown() |
|
| 1160 | - { |
|
| 1161 | - parent::tearDown(); |
|
| 1162 | - } |
|
| 1008 | + } |
|
| 1009 | + |
|
| 1010 | + public function testListingMapWidget() { |
|
| 1011 | + |
|
| 1012 | + $template = geodir_plugin_path() . '/geodirectory-widgets/listing_map_widget.php'; |
|
| 1013 | + include_once($template); |
|
| 1014 | + |
|
| 1015 | + //listing page |
|
| 1016 | + $this->go_to( home_url('/?post_type=gd_place') ); |
|
| 1017 | + |
|
| 1018 | + ob_start(); |
|
| 1019 | + $instance = array(); |
|
| 1020 | + $args = array(); |
|
| 1021 | + $args["widget_id"] = "geodir_map_v3_listing_map-2"; |
|
| 1022 | + the_widget( 'geodir_map_listingpage', $instance, $args ); |
|
| 1023 | + $output = ob_get_contents(); |
|
| 1024 | + ob_end_clean(); |
|
| 1025 | + $this->assertContains('geodir-map-listing-page', $output); |
|
| 1026 | + |
|
| 1027 | + // detail page |
|
| 1028 | + $query_args = array( |
|
| 1029 | + 'post_status' => 'publish', |
|
| 1030 | + 'post_type' => 'gd_place', |
|
| 1031 | + 'posts_per_page' => 1, |
|
| 1032 | + ); |
|
| 1033 | + |
|
| 1034 | + $all_posts = new WP_Query( $query_args ); |
|
| 1035 | + $post_id = null; |
|
| 1036 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
| 1037 | + $post_id = get_the_ID(); |
|
| 1038 | + endwhile; |
|
| 1039 | + |
|
| 1040 | + $this->assertTrue(is_int($post_id)); |
|
| 1041 | + |
|
| 1042 | + $this->go_to( get_permalink($post_id) ); |
|
| 1043 | + |
|
| 1044 | + ob_start(); |
|
| 1045 | + $instance = array(); |
|
| 1046 | + $args = array(); |
|
| 1047 | + $args["widget_id"] = "geodir_map_v3_listing_map-2"; |
|
| 1048 | + the_widget( 'geodir_map_listingpage', $instance, $args ); |
|
| 1049 | + $output = ob_get_contents(); |
|
| 1050 | + ob_end_clean(); |
|
| 1051 | + $this->assertContains('geodir-map-listing-page', $output); |
|
| 1052 | + |
|
| 1053 | + ob_start(); |
|
| 1054 | + $this->the_widget_form( 'geodir_map_listingpage' ); |
|
| 1055 | + $output = ob_get_contents(); |
|
| 1056 | + ob_end_clean(); |
|
| 1057 | + $this->assertContains('Select Map View', $output); |
|
| 1058 | + |
|
| 1059 | + $new_instance = array( |
|
| 1060 | + 'width' => '', |
|
| 1061 | + 'heigh' => '', |
|
| 1062 | + 'maptype' => '', |
|
| 1063 | + 'zoom' => '', |
|
| 1064 | + 'autozoom' => '', |
|
| 1065 | + 'sticky' => '', |
|
| 1066 | + 'scrollwheel' => '0', |
|
| 1067 | + 'showall' => '0' |
|
| 1068 | + ); |
|
| 1069 | + $output = $this->the_widget_form_update( 'geodir_map_listingpage', $new_instance ); |
|
| 1070 | + $this->assertContains('0', $output['scrollwheel']); |
|
| 1071 | + |
|
| 1072 | + |
|
| 1073 | + } |
|
| 1074 | + |
|
| 1075 | + private function load_template() { |
|
| 1076 | + do_action( 'template_redirect' ); |
|
| 1077 | + $template = false; |
|
| 1078 | + if ( is_404() && $template = get_404_template() ) : |
|
| 1079 | + elseif ( is_search() && $template = get_search_template() ) : |
|
| 1080 | + elseif ( is_front_page() && $template = get_front_page_template() ) : |
|
| 1081 | + elseif ( is_home() && $template = get_home_template() ) : |
|
| 1082 | + elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) : |
|
| 1083 | + elseif ( is_tax() && $template = get_taxonomy_template() ) : |
|
| 1084 | + elseif ( is_attachment() && $template = get_attachment_template() ) : |
|
| 1085 | + remove_filter('the_content', 'prepend_attachment'); |
|
| 1086 | + elseif ( is_single() && $template = get_single_template() ) : |
|
| 1087 | + elseif ( is_page() && $template = get_page_template() ) : |
|
| 1088 | + elseif ( is_category() && $template = get_category_template() ) : |
|
| 1089 | + elseif ( is_tag() && $template = get_tag_template() ) : |
|
| 1090 | + elseif ( is_author() && $template = get_author_template() ) : |
|
| 1091 | + elseif ( is_date() && $template = get_date_template() ) : |
|
| 1092 | + elseif ( is_archive() && $template = get_archive_template() ) : |
|
| 1093 | + elseif ( is_paged() && $template = get_paged_template() ) : |
|
| 1094 | + else : |
|
| 1095 | + $template = get_index_template(); |
|
| 1096 | + endif; |
|
| 1097 | + /** |
|
| 1098 | + * Filter the path of the current template before including it. |
|
| 1099 | + * |
|
| 1100 | + * @since 3.0.0 |
|
| 1101 | + * |
|
| 1102 | + * @param string $template The path of the template to include. |
|
| 1103 | + */ |
|
| 1104 | + if ( $template = apply_filters( 'template_include', $template ) ) { |
|
| 1105 | + $template_contents = file_get_contents( $template ); |
|
| 1106 | + $included_header = $included_footer = false; |
|
| 1107 | + if ( false !== stripos( $template_contents, 'get_header();' ) ) { |
|
| 1108 | + do_action( 'get_header', null ); |
|
| 1109 | + locate_template( 'header.php', true, false ); |
|
| 1110 | + $included_header = true; |
|
| 1111 | + } |
|
| 1112 | + include( $template ); |
|
| 1113 | + if ( false !== stripos( $template_contents, 'get_footer();' ) ) { |
|
| 1114 | + do_action( 'get_footer', null ); |
|
| 1115 | + locate_template( 'footer.php', true, false ); |
|
| 1116 | + $included_footer = true; |
|
| 1117 | + } |
|
| 1118 | + if ( $included_header && $included_footer ) { |
|
| 1119 | + global $wp_scripts; |
|
| 1120 | + $wp_scripts->done = array(); |
|
| 1121 | + } |
|
| 1122 | + } |
|
| 1123 | + return; |
|
| 1124 | + } |
|
| 1125 | + |
|
| 1126 | + public static function setPermalinkStructure( $struc = '/%postname%/' ) { |
|
| 1127 | + global $wp_rewrite; |
|
| 1128 | + $wp_rewrite->set_permalink_structure( $struc ); |
|
| 1129 | + $wp_rewrite->flush_rules(); |
|
| 1130 | + update_option( 'permalink_structure', $struc ); |
|
| 1131 | + flush_rewrite_rules( true ); |
|
| 1132 | + } |
|
| 1133 | + |
|
| 1134 | + function the_widget_form( $widget, $instance = array() ) { |
|
| 1135 | + global $wp_widget_factory; |
|
| 1136 | + |
|
| 1137 | + $widget_obj = $wp_widget_factory->widgets[$widget]; |
|
| 1138 | + if ( ! ( $widget_obj instanceof WP_Widget ) ) { |
|
| 1139 | + return; |
|
| 1140 | + } |
|
| 1141 | + |
|
| 1142 | + $widget_obj->_set(-1); |
|
| 1143 | + $widget_obj->form($instance); |
|
| 1144 | + } |
|
| 1145 | + |
|
| 1146 | + function the_widget_form_update( $widget, $new_instance = array(), $old_instance = array() ) { |
|
| 1147 | + global $wp_widget_factory; |
|
| 1148 | + |
|
| 1149 | + $widget_obj = $wp_widget_factory->widgets[$widget]; |
|
| 1150 | + if ( ! ( $widget_obj instanceof WP_Widget ) ) { |
|
| 1151 | + return; |
|
| 1152 | + } |
|
| 1153 | + |
|
| 1154 | + $widget_obj->_set(-1); |
|
| 1155 | + return $widget_obj->update($new_instance, $old_instance); |
|
| 1156 | + } |
|
| 1157 | + |
|
| 1158 | + |
|
| 1159 | + public function tearDown() |
|
| 1160 | + { |
|
| 1161 | + parent::tearDown(); |
|
| 1162 | + } |
|
| 1163 | 1163 | } |
| 1164 | 1164 | ?> |
| 1165 | 1165 | \ No newline at end of file |
@@ -1,102 +1,102 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class MiscTests extends WP_UnitTestCase |
| 3 | 3 | { |
| 4 | - public function setUp() |
|
| 5 | - { |
|
| 6 | - parent::setUp(); |
|
| 7 | - wp_set_current_user(1); |
|
| 8 | - } |
|
| 4 | + public function setUp() |
|
| 5 | + { |
|
| 6 | + parent::setUp(); |
|
| 7 | + wp_set_current_user(1); |
|
| 8 | + } |
|
| 9 | 9 | |
| 10 | - public function testOptionDesignSettings() { |
|
| 10 | + public function testOptionDesignSettings() { |
|
| 11 | 11 | |
| 12 | - geodir_post_type_setting_fun(); |
|
| 13 | - global $geodir_settings; |
|
| 12 | + geodir_post_type_setting_fun(); |
|
| 13 | + global $geodir_settings; |
|
| 14 | 14 | |
| 15 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/design_settings_array.php'; |
|
| 16 | - include_once($template); |
|
| 15 | + $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/design_settings_array.php'; |
|
| 16 | + include_once($template); |
|
| 17 | 17 | |
| 18 | - $output = $geodir_settings['design_settings']; |
|
| 18 | + $output = $geodir_settings['design_settings']; |
|
| 19 | 19 | |
| 20 | - $this->assertContains('Home Top Section Settings', $output[1]['name']); |
|
| 21 | - } |
|
| 20 | + $this->assertContains('Home Top Section Settings', $output[1]['name']); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function testOptionGeneralSettings() { |
|
| 23 | + public function testOptionGeneralSettings() { |
|
| 24 | 24 | |
| 25 | - geodir_post_type_setting_fun(); |
|
| 26 | - global $geodir_settings; |
|
| 25 | + geodir_post_type_setting_fun(); |
|
| 26 | + global $geodir_settings; |
|
| 27 | 27 | |
| 28 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/general_settings_array.php'; |
|
| 29 | - include_once($template); |
|
| 28 | + $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/general_settings_array.php'; |
|
| 29 | + include_once($template); |
|
| 30 | 30 | |
| 31 | - $output = $geodir_settings['general_settings']; |
|
| 31 | + $output = $geodir_settings['general_settings']; |
|
| 32 | 32 | |
| 33 | - $this->assertContains('General', $output[0]['name']); |
|
| 34 | - } |
|
| 33 | + $this->assertContains('General', $output[0]['name']); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - public function testOptionNotiSettings() { |
|
| 36 | + public function testOptionNotiSettings() { |
|
| 37 | 37 | |
| 38 | - geodir_post_type_setting_fun(); |
|
| 39 | - global $geodir_settings; |
|
| 38 | + geodir_post_type_setting_fun(); |
|
| 39 | + global $geodir_settings; |
|
| 40 | 40 | |
| 41 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/notifications_settings_array.php'; |
|
| 42 | - include_once($template); |
|
| 41 | + $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/notifications_settings_array.php'; |
|
| 42 | + include_once($template); |
|
| 43 | 43 | |
| 44 | - $output = $geodir_settings['notifications_settings']; |
|
| 44 | + $output = $geodir_settings['notifications_settings']; |
|
| 45 | 45 | |
| 46 | - $this->assertContains('Options', $output[0]['name']); |
|
| 47 | - } |
|
| 46 | + $this->assertContains('Options', $output[0]['name']); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - public function testOptionPermalinkSettings() { |
|
| 49 | + public function testOptionPermalinkSettings() { |
|
| 50 | 50 | |
| 51 | - geodir_post_type_setting_fun(); |
|
| 52 | - global $geodir_settings; |
|
| 51 | + geodir_post_type_setting_fun(); |
|
| 52 | + global $geodir_settings; |
|
| 53 | 53 | |
| 54 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/permalink_settings_array.php'; |
|
| 55 | - include_once($template); |
|
| 54 | + $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/permalink_settings_array.php'; |
|
| 55 | + include_once($template); |
|
| 56 | 56 | |
| 57 | - $output = $geodir_settings['permalink_settings']; |
|
| 57 | + $output = $geodir_settings['permalink_settings']; |
|
| 58 | 58 | |
| 59 | - $this->assertContains('Permalink', $output[0]['name']); |
|
| 60 | - } |
|
| 59 | + $this->assertContains('Permalink', $output[0]['name']); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - public function testOptionMetaSettings() { |
|
| 62 | + public function testOptionMetaSettings() { |
|
| 63 | 63 | |
| 64 | - geodir_post_type_setting_fun(); |
|
| 65 | - global $geodir_settings; |
|
| 64 | + geodir_post_type_setting_fun(); |
|
| 65 | + global $geodir_settings; |
|
| 66 | 66 | |
| 67 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/title_meta_settings_array.php'; |
|
| 68 | - include_once($template); |
|
| 67 | + $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/title_meta_settings_array.php'; |
|
| 68 | + include_once($template); |
|
| 69 | 69 | |
| 70 | - $output = $geodir_settings['title_meta_settings']; |
|
| 70 | + $output = $geodir_settings['title_meta_settings']; |
|
| 71 | 71 | |
| 72 | - $this->assertContains('Title / Meta', $output[0]['name']); |
|
| 73 | - } |
|
| 72 | + $this->assertContains('Title / Meta', $output[0]['name']); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - public function testDiagnose() { |
|
| 76 | - ob_start(); |
|
| 77 | - geodir_diagnose_default_pages(); |
|
| 78 | - $output = ob_get_contents(); |
|
| 79 | - ob_end_clean(); |
|
| 80 | - $this->assertContains( 'GD Home page exists with proper setting', $output ); |
|
| 81 | - $this->assertContains( 'Add Listing page exists with proper setting', $output ); |
|
| 82 | - $this->assertContains( 'Listing Preview page exists with proper setting', $output ); |
|
| 83 | - $this->assertContains( 'Listing Success page exists with proper setting', $output ); |
|
| 84 | - $this->assertContains( 'Info page exists with proper setting', $output ); |
|
| 85 | - $this->assertContains( 'Login page exists with proper setting', $output ); |
|
| 86 | - $this->assertContains( 'Location page exists with proper setting', $output ); |
|
| 75 | + public function testDiagnose() { |
|
| 76 | + ob_start(); |
|
| 77 | + geodir_diagnose_default_pages(); |
|
| 78 | + $output = ob_get_contents(); |
|
| 79 | + ob_end_clean(); |
|
| 80 | + $this->assertContains( 'GD Home page exists with proper setting', $output ); |
|
| 81 | + $this->assertContains( 'Add Listing page exists with proper setting', $output ); |
|
| 82 | + $this->assertContains( 'Listing Preview page exists with proper setting', $output ); |
|
| 83 | + $this->assertContains( 'Listing Success page exists with proper setting', $output ); |
|
| 84 | + $this->assertContains( 'Info page exists with proper setting', $output ); |
|
| 85 | + $this->assertContains( 'Login page exists with proper setting', $output ); |
|
| 86 | + $this->assertContains( 'Location page exists with proper setting', $output ); |
|
| 87 | 87 | |
| 88 | - ob_start(); |
|
| 89 | - geodir_diagnose_load_db_language(); |
|
| 90 | - $output = ob_get_contents(); |
|
| 91 | - ob_end_clean(); |
|
| 92 | - $this->assertContains( 'ul', $output ); |
|
| 88 | + ob_start(); |
|
| 89 | + geodir_diagnose_load_db_language(); |
|
| 90 | + $output = ob_get_contents(); |
|
| 91 | + ob_end_clean(); |
|
| 92 | + $this->assertContains( 'ul', $output ); |
|
| 93 | 93 | |
| 94 | - } |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - public function tearDown() |
|
| 97 | - { |
|
| 98 | - parent::tearDown(); |
|
| 99 | - } |
|
| 96 | + public function tearDown() |
|
| 97 | + { |
|
| 98 | + parent::tearDown(); |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | 101 | } |
| 102 | 102 | ?> |
| 103 | 103 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | geodir_post_type_setting_fun(); |
| 13 | 13 | global $geodir_settings; |
| 14 | 14 | |
| 15 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/design_settings_array.php'; |
|
| 15 | + $template = geodir_plugin_path().'/geodirectory-admin/option-pages/design_settings_array.php'; |
|
| 16 | 16 | include_once($template); |
| 17 | 17 | |
| 18 | 18 | $output = $geodir_settings['design_settings']; |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | geodir_post_type_setting_fun(); |
| 26 | 26 | global $geodir_settings; |
| 27 | 27 | |
| 28 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/general_settings_array.php'; |
|
| 28 | + $template = geodir_plugin_path().'/geodirectory-admin/option-pages/general_settings_array.php'; |
|
| 29 | 29 | include_once($template); |
| 30 | 30 | |
| 31 | 31 | $output = $geodir_settings['general_settings']; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | geodir_post_type_setting_fun(); |
| 39 | 39 | global $geodir_settings; |
| 40 | 40 | |
| 41 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/notifications_settings_array.php'; |
|
| 41 | + $template = geodir_plugin_path().'/geodirectory-admin/option-pages/notifications_settings_array.php'; |
|
| 42 | 42 | include_once($template); |
| 43 | 43 | |
| 44 | 44 | $output = $geodir_settings['notifications_settings']; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | geodir_post_type_setting_fun(); |
| 52 | 52 | global $geodir_settings; |
| 53 | 53 | |
| 54 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/permalink_settings_array.php'; |
|
| 54 | + $template = geodir_plugin_path().'/geodirectory-admin/option-pages/permalink_settings_array.php'; |
|
| 55 | 55 | include_once($template); |
| 56 | 56 | |
| 57 | 57 | $output = $geodir_settings['permalink_settings']; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | geodir_post_type_setting_fun(); |
| 65 | 65 | global $geodir_settings; |
| 66 | 66 | |
| 67 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/title_meta_settings_array.php'; |
|
| 67 | + $template = geodir_plugin_path().'/geodirectory-admin/option-pages/title_meta_settings_array.php'; |
|
| 68 | 68 | include_once($template); |
| 69 | 69 | |
| 70 | 70 | $output = $geodir_settings['title_meta_settings']; |
@@ -77,19 +77,19 @@ discard block |
||
| 77 | 77 | geodir_diagnose_default_pages(); |
| 78 | 78 | $output = ob_get_contents(); |
| 79 | 79 | ob_end_clean(); |
| 80 | - $this->assertContains( 'GD Home page exists with proper setting', $output ); |
|
| 81 | - $this->assertContains( 'Add Listing page exists with proper setting', $output ); |
|
| 82 | - $this->assertContains( 'Listing Preview page exists with proper setting', $output ); |
|
| 83 | - $this->assertContains( 'Listing Success page exists with proper setting', $output ); |
|
| 84 | - $this->assertContains( 'Info page exists with proper setting', $output ); |
|
| 85 | - $this->assertContains( 'Login page exists with proper setting', $output ); |
|
| 86 | - $this->assertContains( 'Location page exists with proper setting', $output ); |
|
| 80 | + $this->assertContains('GD Home page exists with proper setting', $output); |
|
| 81 | + $this->assertContains('Add Listing page exists with proper setting', $output); |
|
| 82 | + $this->assertContains('Listing Preview page exists with proper setting', $output); |
|
| 83 | + $this->assertContains('Listing Success page exists with proper setting', $output); |
|
| 84 | + $this->assertContains('Info page exists with proper setting', $output); |
|
| 85 | + $this->assertContains('Login page exists with proper setting', $output); |
|
| 86 | + $this->assertContains('Location page exists with proper setting', $output); |
|
| 87 | 87 | |
| 88 | 88 | ob_start(); |
| 89 | 89 | geodir_diagnose_load_db_language(); |
| 90 | 90 | $output = ob_get_contents(); |
| 91 | 91 | ob_end_clean(); |
| 92 | - $this->assertContains( 'ul', $output ); |
|
| 92 | + $this->assertContains('ul', $output); |
|
| 93 | 93 | |
| 94 | 94 | } |
| 95 | 95 | |
@@ -1,75 +1,75 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class AdminTests extends WP_UnitTestCase |
| 3 | 3 | { |
| 4 | - public function setUp() |
|
| 5 | - { |
|
| 6 | - parent::setUp(); |
|
| 7 | - wp_set_current_user(1); |
|
| 8 | - } |
|
| 4 | + public function setUp() |
|
| 5 | + { |
|
| 6 | + parent::setUp(); |
|
| 7 | + wp_set_current_user(1); |
|
| 8 | + } |
|
| 9 | 9 | |
| 10 | - public function testAdminPanel() |
|
| 11 | - { |
|
| 10 | + public function testAdminPanel() |
|
| 11 | + { |
|
| 12 | 12 | |
| 13 | - $_POST = array( |
|
| 14 | - 'geodir_wrapper_open_id' => '', |
|
| 15 | - 'geodir_wrapper_open_class' => 'main-container clearfix', |
|
| 16 | - 'geodir_wrapper_open_replace' => '', |
|
| 17 | - 'geodir_wrapper_close_replace' => '', |
|
| 18 | - 'geodir_wrapper_content_open_id' => '', |
|
| 19 | - 'geodir_wrapper_content_open_class' => '', |
|
| 20 | - 'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content "><div class="site-content page-wrap">', |
|
| 21 | - 'geodir_wrapper_content_close_replace' => '</div></div></div>', |
|
| 22 | - 'geodir_article_open_id' => '', |
|
| 23 | - 'geodir_article_open_class' => '', |
|
| 24 | - 'geodir_article_open_replace' => '', |
|
| 25 | - 'geodir_article_close_replace' => '', |
|
| 26 | - 'geodir_sidebar_right_open_id' => '', |
|
| 27 | - 'geodir_sidebar_right_open_class' => '', |
|
| 28 | - 'geodir_sidebar_right_open_replace' => '<aside class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 29 | - 'geodir_sidebar_right_close_replace' => '', |
|
| 30 | - 'geodir_sidebar_left_open_id' => '', |
|
| 31 | - 'geodir_sidebar_left_open_class' => '', |
|
| 32 | - 'geodir_sidebar_left_open_replace' => '<aside class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 33 | - 'geodir_sidebar_left_close_replace' => '', |
|
| 34 | - 'geodir_main_content_open_id' => '', |
|
| 35 | - 'geodir_main_content_open_class' => '', |
|
| 36 | - 'geodir_main_content_open_replace' => '<div class="site-content page-wrap">', |
|
| 37 | - 'geodir_main_content_close_replace' => '</div>', |
|
| 38 | - 'geodir_top_content_add' => '', |
|
| 39 | - 'geodir_before_main_content_add' => '', |
|
| 40 | - 'geodir_full_page_class_filter' => 'section full-width-section', |
|
| 41 | - 'geodir_before_widget_filter' => '', |
|
| 42 | - 'geodir_after_widget_filter' => '', |
|
| 43 | - 'geodir_before_title_filter' => '<div class="widget-title"><h2>', |
|
| 44 | - 'geodir_after_title_filter' => '</h2></div>', |
|
| 45 | - 'geodir_menu_li_class_filter' => '', |
|
| 46 | - 'geodir_sub_menu_ul_class_filter' => '', |
|
| 47 | - 'geodir_sub_menu_li_class_filter' => '', |
|
| 48 | - 'geodir_menu_a_class_filter' => '', |
|
| 49 | - 'geodir_sub_menu_a_class_filter' => '', |
|
| 50 | - 'geodir_location_switcher_menu_li_class_filter' => '', |
|
| 51 | - 'geodir_location_switcher_menu_a_class_filter' => '', |
|
| 52 | - 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
| 53 | - 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
| 54 | - 'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'), |
|
| 55 | - 'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});', |
|
| 56 | - 'geodir_theme_compat_default_options' => '', |
|
| 57 | - 'geodir_theme_compat_code' => 'Multi_News', |
|
| 58 | - 'gd_theme_compat' => 'Twenty_Fifteen_custom' |
|
| 59 | - ); |
|
| 60 | - geodir_update_options_compatibility_settings(); |
|
| 13 | + $_POST = array( |
|
| 14 | + 'geodir_wrapper_open_id' => '', |
|
| 15 | + 'geodir_wrapper_open_class' => 'main-container clearfix', |
|
| 16 | + 'geodir_wrapper_open_replace' => '', |
|
| 17 | + 'geodir_wrapper_close_replace' => '', |
|
| 18 | + 'geodir_wrapper_content_open_id' => '', |
|
| 19 | + 'geodir_wrapper_content_open_class' => '', |
|
| 20 | + 'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content "><div class="site-content page-wrap">', |
|
| 21 | + 'geodir_wrapper_content_close_replace' => '</div></div></div>', |
|
| 22 | + 'geodir_article_open_id' => '', |
|
| 23 | + 'geodir_article_open_class' => '', |
|
| 24 | + 'geodir_article_open_replace' => '', |
|
| 25 | + 'geodir_article_close_replace' => '', |
|
| 26 | + 'geodir_sidebar_right_open_id' => '', |
|
| 27 | + 'geodir_sidebar_right_open_class' => '', |
|
| 28 | + 'geodir_sidebar_right_open_replace' => '<aside class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 29 | + 'geodir_sidebar_right_close_replace' => '', |
|
| 30 | + 'geodir_sidebar_left_open_id' => '', |
|
| 31 | + 'geodir_sidebar_left_open_class' => '', |
|
| 32 | + 'geodir_sidebar_left_open_replace' => '<aside class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
| 33 | + 'geodir_sidebar_left_close_replace' => '', |
|
| 34 | + 'geodir_main_content_open_id' => '', |
|
| 35 | + 'geodir_main_content_open_class' => '', |
|
| 36 | + 'geodir_main_content_open_replace' => '<div class="site-content page-wrap">', |
|
| 37 | + 'geodir_main_content_close_replace' => '</div>', |
|
| 38 | + 'geodir_top_content_add' => '', |
|
| 39 | + 'geodir_before_main_content_add' => '', |
|
| 40 | + 'geodir_full_page_class_filter' => 'section full-width-section', |
|
| 41 | + 'geodir_before_widget_filter' => '', |
|
| 42 | + 'geodir_after_widget_filter' => '', |
|
| 43 | + 'geodir_before_title_filter' => '<div class="widget-title"><h2>', |
|
| 44 | + 'geodir_after_title_filter' => '</h2></div>', |
|
| 45 | + 'geodir_menu_li_class_filter' => '', |
|
| 46 | + 'geodir_sub_menu_ul_class_filter' => '', |
|
| 47 | + 'geodir_sub_menu_li_class_filter' => '', |
|
| 48 | + 'geodir_menu_a_class_filter' => '', |
|
| 49 | + 'geodir_sub_menu_a_class_filter' => '', |
|
| 50 | + 'geodir_location_switcher_menu_li_class_filter' => '', |
|
| 51 | + 'geodir_location_switcher_menu_a_class_filter' => '', |
|
| 52 | + 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
| 53 | + 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
| 54 | + 'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'), |
|
| 55 | + 'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});', |
|
| 56 | + 'geodir_theme_compat_default_options' => '', |
|
| 57 | + 'geodir_theme_compat_code' => 'Multi_News', |
|
| 58 | + 'gd_theme_compat' => 'Twenty_Fifteen_custom' |
|
| 59 | + ); |
|
| 60 | + geodir_update_options_compatibility_settings(); |
|
| 61 | 61 | |
| 62 | - ob_start(); |
|
| 63 | - geodir_admin_panel(); |
|
| 64 | - $output = ob_get_contents(); |
|
| 65 | - ob_end_clean(); |
|
| 66 | - $this->assertContains( 'gd-wrapper-main', $output ); |
|
| 62 | + ob_start(); |
|
| 63 | + geodir_admin_panel(); |
|
| 64 | + $output = ob_get_contents(); |
|
| 65 | + ob_end_clean(); |
|
| 66 | + $this->assertContains( 'gd-wrapper-main', $output ); |
|
| 67 | 67 | |
| 68 | - } |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - public function tearDown() |
|
| 71 | - { |
|
| 72 | - parent::tearDown(); |
|
| 73 | - } |
|
| 70 | + public function tearDown() |
|
| 71 | + { |
|
| 72 | + parent::tearDown(); |
|
| 73 | + } |
|
| 74 | 74 | } |
| 75 | 75 | ?> |
| 76 | 76 | \ No newline at end of file |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | geodir_admin_panel(); |
| 64 | 64 | $output = ob_get_contents(); |
| 65 | 65 | ob_end_clean(); |
| 66 | - $this->assertContains( 'gd-wrapper-main', $output ); |
|
| 66 | + $this->assertContains('gd-wrapper-main', $output); |
|
| 67 | 67 | |
| 68 | 68 | } |
| 69 | 69 | |
@@ -1,102 +1,102 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class Register extends WP_UnitTestCase |
| 3 | 3 | { |
| 4 | - public function setUp() |
|
| 5 | - { |
|
| 6 | - parent::setUp(); |
|
| 7 | - wp_set_current_user(0); |
|
| 8 | - } |
|
| 4 | + public function setUp() |
|
| 5 | + { |
|
| 6 | + parent::setUp(); |
|
| 7 | + wp_set_current_user(0); |
|
| 8 | + } |
|
| 9 | 9 | |
| 10 | - public function test_register_empty_username() { |
|
| 11 | - $errors = geodir_register_new_user( |
|
| 12 | - '', |
|
| 13 | - '[email protected]' |
|
| 14 | - ); |
|
| 15 | - $errors = (array) $errors; |
|
| 16 | - $this->assertArrayHasKey( 'empty_username', $errors["errors"] ); |
|
| 17 | - $this->assertContains( 'Please enter a username', $errors["errors"]["empty_username"][0] ); |
|
| 18 | - } |
|
| 10 | + public function test_register_empty_username() { |
|
| 11 | + $errors = geodir_register_new_user( |
|
| 12 | + '', |
|
| 13 | + '[email protected]' |
|
| 14 | + ); |
|
| 15 | + $errors = (array) $errors; |
|
| 16 | + $this->assertArrayHasKey( 'empty_username', $errors["errors"] ); |
|
| 17 | + $this->assertContains( 'Please enter a username', $errors["errors"]["empty_username"][0] ); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - public function test_register_invalid_username() { |
|
| 21 | - $errors = geodir_register_new_user( |
|
| 22 | - '@#$%^', |
|
| 23 | - '[email protected]' |
|
| 24 | - ); |
|
| 25 | - $errors = (array) $errors; |
|
| 26 | - $this->assertArrayHasKey( 'invalid_username', $errors["errors"] ); |
|
| 27 | - $this->assertContains( 'This username is invalid', $errors["errors"]["invalid_username"][0] ); |
|
| 28 | - } |
|
| 20 | + public function test_register_invalid_username() { |
|
| 21 | + $errors = geodir_register_new_user( |
|
| 22 | + '@#$%^', |
|
| 23 | + '[email protected]' |
|
| 24 | + ); |
|
| 25 | + $errors = (array) $errors; |
|
| 26 | + $this->assertArrayHasKey( 'invalid_username', $errors["errors"] ); |
|
| 27 | + $this->assertContains( 'This username is invalid', $errors["errors"]["invalid_username"][0] ); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - public function test_register_invalid_email() { |
|
| 31 | - $errors = geodir_register_new_user( |
|
| 32 | - 'hello', |
|
| 33 | - 'hello@@hi.com' |
|
| 34 | - ); |
|
| 35 | - $errors = (array) $errors; |
|
| 36 | - $this->assertArrayHasKey( 'invalid_email', $errors["errors"] ); |
|
| 37 | - $this->assertContains( 'The email address isn’t correct', $errors["errors"]["invalid_email"][0] ); |
|
| 38 | - } |
|
| 30 | + public function test_register_invalid_email() { |
|
| 31 | + $errors = geodir_register_new_user( |
|
| 32 | + 'hello', |
|
| 33 | + 'hello@@hi.com' |
|
| 34 | + ); |
|
| 35 | + $errors = (array) $errors; |
|
| 36 | + $this->assertArrayHasKey( 'invalid_email', $errors["errors"] ); |
|
| 37 | + $this->assertContains( 'The email address isn’t correct', $errors["errors"]["invalid_email"][0] ); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - public function test_register_empty_email() { |
|
| 41 | - $errors = geodir_register_new_user( |
|
| 42 | - 'hello', |
|
| 43 | - '' |
|
| 44 | - ); |
|
| 45 | - $errors = (array) $errors; |
|
| 46 | - $this->assertArrayHasKey( 'empty_email', $errors["errors"] ); |
|
| 47 | - $this->assertContains( 'Please type your e-mail address', $errors["errors"]["empty_email"][0] ); |
|
| 48 | - } |
|
| 40 | + public function test_register_empty_email() { |
|
| 41 | + $errors = geodir_register_new_user( |
|
| 42 | + 'hello', |
|
| 43 | + '' |
|
| 44 | + ); |
|
| 45 | + $errors = (array) $errors; |
|
| 46 | + $this->assertArrayHasKey( 'empty_email', $errors["errors"] ); |
|
| 47 | + $this->assertContains( 'Please type your e-mail address', $errors["errors"]["empty_email"][0] ); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - public function test_register_invalid_password() { |
|
| 51 | - update_option('geodir_allow_cpass', 1); |
|
| 52 | - $_REQUEST['user_pass'] = '12345'; |
|
| 53 | - $_REQUEST['user_pass2'] = '1234'; |
|
| 54 | - $_POST['user_fname'] = 'Test User'; |
|
| 55 | - $errors = geodir_register_new_user( |
|
| 56 | - 'hello', |
|
| 57 | - '[email protected]' |
|
| 58 | - ); |
|
| 59 | - $errors = (array) $errors; |
|
| 60 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
| 61 | - $this->assertContains( 'Passwords do not match', $errors["errors"]["pass_match"][0] ); |
|
| 50 | + public function test_register_invalid_password() { |
|
| 51 | + update_option('geodir_allow_cpass', 1); |
|
| 52 | + $_REQUEST['user_pass'] = '12345'; |
|
| 53 | + $_REQUEST['user_pass2'] = '1234'; |
|
| 54 | + $_POST['user_fname'] = 'Test User'; |
|
| 55 | + $errors = geodir_register_new_user( |
|
| 56 | + 'hello', |
|
| 57 | + '[email protected]' |
|
| 58 | + ); |
|
| 59 | + $errors = (array) $errors; |
|
| 60 | + $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
| 61 | + $this->assertContains( 'Passwords do not match', $errors["errors"]["pass_match"][0] ); |
|
| 62 | 62 | |
| 63 | - $_REQUEST['user_pass'] = '12345'; |
|
| 64 | - $_REQUEST['user_pass2'] = '12345'; |
|
| 65 | - $errors = geodir_register_new_user( |
|
| 66 | - 'hello', |
|
| 67 | - '[email protected]' |
|
| 68 | - ); |
|
| 69 | - $errors = (array) $errors; |
|
| 70 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
| 71 | - $this->assertContains( 'Password must be 7 characters or more', $errors["errors"]["pass_match"][0] ); |
|
| 72 | - } |
|
| 63 | + $_REQUEST['user_pass'] = '12345'; |
|
| 64 | + $_REQUEST['user_pass2'] = '12345'; |
|
| 65 | + $errors = geodir_register_new_user( |
|
| 66 | + 'hello', |
|
| 67 | + '[email protected]' |
|
| 68 | + ); |
|
| 69 | + $errors = (array) $errors; |
|
| 70 | + $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
| 71 | + $this->assertContains( 'Password must be 7 characters or more', $errors["errors"]["pass_match"][0] ); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - public function test_register_success() { |
|
| 75 | - $_POST['user_fname'] = 'Test User'; |
|
| 76 | - $data = geodir_register_new_user( |
|
| 77 | - 'hello', |
|
| 78 | - '[email protected]' |
|
| 79 | - ); |
|
| 80 | - $this->assertInternalType("int", $data[0]); |
|
| 81 | - } |
|
| 74 | + public function test_register_success() { |
|
| 75 | + $_POST['user_fname'] = 'Test User'; |
|
| 76 | + $data = geodir_register_new_user( |
|
| 77 | + 'hello', |
|
| 78 | + '[email protected]' |
|
| 79 | + ); |
|
| 80 | + $this->assertInternalType("int", $data[0]); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - public function testResetPassword() |
|
| 84 | - { |
|
| 85 | - global $errors; |
|
| 86 | - $_REQUEST['action'] = 'login'; |
|
| 87 | - $_POST['log'] = 'admin'; |
|
| 88 | - add_filter('wp_redirect', '__return_false'); |
|
| 89 | - geodir_user_signup(); |
|
| 90 | - remove_filter('wp_redirect', '__return_false'); |
|
| 91 | - $errors = (array) $errors; |
|
| 92 | - $this->assertArrayHasKey( 'empty_password', $errors["errors"] ); |
|
| 93 | - $this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] ); |
|
| 94 | - } |
|
| 83 | + public function testResetPassword() |
|
| 84 | + { |
|
| 85 | + global $errors; |
|
| 86 | + $_REQUEST['action'] = 'login'; |
|
| 87 | + $_POST['log'] = 'admin'; |
|
| 88 | + add_filter('wp_redirect', '__return_false'); |
|
| 89 | + geodir_user_signup(); |
|
| 90 | + remove_filter('wp_redirect', '__return_false'); |
|
| 91 | + $errors = (array) $errors; |
|
| 92 | + $this->assertArrayHasKey( 'empty_password', $errors["errors"] ); |
|
| 93 | + $this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] ); |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - public function tearDown() |
|
| 97 | - { |
|
| 98 | - parent::tearDown(); |
|
| 99 | - } |
|
| 96 | + public function tearDown() |
|
| 97 | + { |
|
| 98 | + parent::tearDown(); |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | 101 | } |
| 102 | 102 | ?> |
| 103 | 103 | \ No newline at end of file |
@@ -13,8 +13,8 @@ discard block |
||
| 13 | 13 | '[email protected]' |
| 14 | 14 | ); |
| 15 | 15 | $errors = (array) $errors; |
| 16 | - $this->assertArrayHasKey( 'empty_username', $errors["errors"] ); |
|
| 17 | - $this->assertContains( 'Please enter a username', $errors["errors"]["empty_username"][0] ); |
|
| 16 | + $this->assertArrayHasKey('empty_username', $errors["errors"]); |
|
| 17 | + $this->assertContains('Please enter a username', $errors["errors"]["empty_username"][0]); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function test_register_invalid_username() { |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | '[email protected]' |
| 24 | 24 | ); |
| 25 | 25 | $errors = (array) $errors; |
| 26 | - $this->assertArrayHasKey( 'invalid_username', $errors["errors"] ); |
|
| 27 | - $this->assertContains( 'This username is invalid', $errors["errors"]["invalid_username"][0] ); |
|
| 26 | + $this->assertArrayHasKey('invalid_username', $errors["errors"]); |
|
| 27 | + $this->assertContains('This username is invalid', $errors["errors"]["invalid_username"][0]); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function test_register_invalid_email() { |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | 'hello@@hi.com' |
| 34 | 34 | ); |
| 35 | 35 | $errors = (array) $errors; |
| 36 | - $this->assertArrayHasKey( 'invalid_email', $errors["errors"] ); |
|
| 37 | - $this->assertContains( 'The email address isn’t correct', $errors["errors"]["invalid_email"][0] ); |
|
| 36 | + $this->assertArrayHasKey('invalid_email', $errors["errors"]); |
|
| 37 | + $this->assertContains('The email address isn’t correct', $errors["errors"]["invalid_email"][0]); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function test_register_empty_email() { |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | '' |
| 44 | 44 | ); |
| 45 | 45 | $errors = (array) $errors; |
| 46 | - $this->assertArrayHasKey( 'empty_email', $errors["errors"] ); |
|
| 47 | - $this->assertContains( 'Please type your e-mail address', $errors["errors"]["empty_email"][0] ); |
|
| 46 | + $this->assertArrayHasKey('empty_email', $errors["errors"]); |
|
| 47 | + $this->assertContains('Please type your e-mail address', $errors["errors"]["empty_email"][0]); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function test_register_invalid_password() { |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | '[email protected]' |
| 58 | 58 | ); |
| 59 | 59 | $errors = (array) $errors; |
| 60 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
| 61 | - $this->assertContains( 'Passwords do not match', $errors["errors"]["pass_match"][0] ); |
|
| 60 | + $this->assertArrayHasKey('pass_match', $errors["errors"]); |
|
| 61 | + $this->assertContains('Passwords do not match', $errors["errors"]["pass_match"][0]); |
|
| 62 | 62 | |
| 63 | 63 | $_REQUEST['user_pass'] = '12345'; |
| 64 | 64 | $_REQUEST['user_pass2'] = '12345'; |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | '[email protected]' |
| 68 | 68 | ); |
| 69 | 69 | $errors = (array) $errors; |
| 70 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
| 71 | - $this->assertContains( 'Password must be 7 characters or more', $errors["errors"]["pass_match"][0] ); |
|
| 70 | + $this->assertArrayHasKey('pass_match', $errors["errors"]); |
|
| 71 | + $this->assertContains('Password must be 7 characters or more', $errors["errors"]["pass_match"][0]); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function test_register_success() { |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | geodir_user_signup(); |
| 90 | 90 | remove_filter('wp_redirect', '__return_false'); |
| 91 | 91 | $errors = (array) $errors; |
| 92 | - $this->assertArrayHasKey( 'empty_password', $errors["errors"] ); |
|
| 93 | - $this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] ); |
|
| 92 | + $this->assertArrayHasKey('empty_password', $errors["errors"]); |
|
| 93 | + $this->assertContains('The password field is empty', $errors["errors"]["empty_password"][0]); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | public function tearDown() |
@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /* Path to the WordPress codebase you'd like to test. Add a backslash in the end. */ |
| 4 | -define( 'ABSPATH', getenv( 'WP_CORE_DIR' ) . '/' ); |
|
| 4 | +define('ABSPATH', getenv('WP_CORE_DIR').'/'); |
|
| 5 | 5 | |
| 6 | 6 | // Test with multisite enabled |
| 7 | -define( 'WP_TESTS_MULTISITE', (bool) getenv( 'WP_MULTISITE' ) ); |
|
| 7 | +define('WP_TESTS_MULTISITE', (bool) getenv('WP_MULTISITE')); |
|
| 8 | 8 | |
| 9 | 9 | // Force known bugs |
| 10 | 10 | // define( 'WP_TESTS_FORCE_KNOWN_BUGS', true ); |
| 11 | 11 | |
| 12 | 12 | // Test with WordPress debug mode on |
| 13 | -define( 'WP_DEBUG', true ); |
|
| 13 | +define('WP_DEBUG', true); |
|
| 14 | 14 | |
| 15 | 15 | // ** MySQL settings ** // |
| 16 | 16 | |
@@ -21,21 +21,21 @@ discard block |
||
| 21 | 21 | // These tests will DROP ALL TABLES in the database with the prefix named below. |
| 22 | 22 | // DO NOT use a production database or one that is shared with something else. |
| 23 | 23 | |
| 24 | -define( 'DB_NAME', 'wordpress_test' ); |
|
| 25 | -define( 'DB_USER', 'root' ); |
|
| 26 | -define( 'DB_PASSWORD', 'root' ); |
|
| 27 | -define( 'DB_HOST', 'localhost' ); |
|
| 28 | -define( 'DB_CHARSET', 'utf8' ); |
|
| 29 | -define( 'DB_COLLATE', '' ); |
|
| 24 | +define('DB_NAME', 'wordpress_test'); |
|
| 25 | +define('DB_USER', 'root'); |
|
| 26 | +define('DB_PASSWORD', 'root'); |
|
| 27 | +define('DB_HOST', 'localhost'); |
|
| 28 | +define('DB_CHARSET', 'utf8'); |
|
| 29 | +define('DB_COLLATE', ''); |
|
| 30 | 30 | |
| 31 | -define( 'WP_TESTS_DOMAIN', 'example.org' ); |
|
| 32 | -define( 'WP_TESTS_EMAIL', '[email protected]' ); |
|
| 33 | -define( 'WP_TESTS_TITLE', 'Test Blog' ); |
|
| 31 | +define('WP_TESTS_DOMAIN', 'example.org'); |
|
| 32 | +define('WP_TESTS_EMAIL', '[email protected]'); |
|
| 33 | +define('WP_TESTS_TITLE', 'Test Blog'); |
|
| 34 | 34 | |
| 35 | -define( 'WP_PHP_BINARY', 'php' ); |
|
| 35 | +define('WP_PHP_BINARY', 'php'); |
|
| 36 | 36 | |
| 37 | -define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) ); |
|
| 38 | -define( 'FS_CHMOD_FILE', ( 0644 & ~ umask() ) ); |
|
| 37 | +define('FS_CHMOD_DIR', (0755 & ~ umask())); |
|
| 38 | +define('FS_CHMOD_FILE', (0644 & ~ umask())); |
|
| 39 | 39 | |
| 40 | -define( 'WPLANG', '' ); |
|
| 41 | -$table_prefix = 'wptests_'; |
|
| 42 | 40 | \ No newline at end of file |
| 41 | +define('WPLANG', ''); |
|
| 42 | +$table_prefix = 'wptests_'; |
|
| 43 | 43 | \ No newline at end of file |
@@ -1,141 +1,141 @@ |
||
| 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 testPopPostCatShortcode() |
|
| 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 testRelatedListingsShortcode() |
|
| 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 testListingsShortcode() |
|
| 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 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
| 123 | - include_once($template); |
|
| 124 | - |
|
| 125 | - $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]'); |
|
| 126 | - $this->assertContains( 'geodir_bestof_widget', $output ); |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - public function testAddListingShortcode() |
|
| 130 | - { |
|
| 131 | - $_REQUEST['listing_type'] = 'gd_place'; |
|
| 132 | - $output = do_shortcode('[gd_add_listing listing_type=gd_place login_msg="Please register and login to submit listings" show_login=true]'); |
|
| 133 | - $this->assertContains( 'geodir-add-listing-submit', $output ); |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - public function tearDown() |
|
| 137 | - { |
|
| 138 | - parent::tearDown(); |
|
| 139 | - } |
|
| 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 testPopPostCatShortcode() |
|
| 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 testRelatedListingsShortcode() |
|
| 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 testListingsShortcode() |
|
| 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 | + $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
| 123 | + include_once($template); |
|
| 124 | + |
|
| 125 | + $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]'); |
|
| 126 | + $this->assertContains( 'geodir_bestof_widget', $output ); |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + public function testAddListingShortcode() |
|
| 130 | + { |
|
| 131 | + $_REQUEST['listing_type'] = 'gd_place'; |
|
| 132 | + $output = do_shortcode('[gd_add_listing listing_type=gd_place login_msg="Please register and login to submit listings" show_login=true]'); |
|
| 133 | + $this->assertContains( 'geodir-add-listing-submit', $output ); |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + public function tearDown() |
|
| 137 | + { |
|
| 138 | + parent::tearDown(); |
|
| 139 | + } |
|
| 140 | 140 | } |
| 141 | 141 | ?> |
| 142 | 142 | \ 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 testPopPostCatShortcode() |
@@ -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 testRelatedListingsShortcode() |
@@ -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,23 +114,23 @@ discard block |
||
| 114 | 114 | public function testListingsShortcode() |
| 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 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
| 122 | + $template = geodir_plugin_path().'/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
| 123 | 123 | include_once($template); |
| 124 | 124 | |
| 125 | 125 | $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]'); |
| 126 | - $this->assertContains( 'geodir_bestof_widget', $output ); |
|
| 126 | + $this->assertContains('geodir_bestof_widget', $output); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | public function testAddListingShortcode() |
| 130 | 130 | { |
| 131 | 131 | $_REQUEST['listing_type'] = 'gd_place'; |
| 132 | 132 | $output = do_shortcode('[gd_add_listing listing_type=gd_place login_msg="Please register and login to submit listings" show_login=true]'); |
| 133 | - $this->assertContains( 'geodir-add-listing-submit', $output ); |
|
| 133 | + $this->assertContains('geodir-add-listing-submit', $output); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | public function tearDown() |