Passed
Pull Request — master (#220)
by Viruthagiri
11:11
created
tests/test-Check_Maps.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -1,69 +1,69 @@
 block discarded – undo
1 1
 <?php
2 2
 class CheckMaps extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+	}
8 8
 
9
-    public function testCheckHomeMap()
10
-    {
11
-        $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]');
12
-        $this->assertContains( 'geodir-map-home-page', $output );
13
-    }
9
+	public function testCheckHomeMap()
10
+	{
11
+		$output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]');
12
+		$this->assertContains( 'geodir-map-home-page', $output );
13
+	}
14 14
 
15
-    public function testListingsPageMap()
16
-    {
17
-        $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]');
18
-        $this->assertContains( 'geodir-map-listing-page', $output );
19
-    }
15
+	public function testListingsPageMap()
16
+	{
17
+		$output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]');
18
+		$this->assertContains( 'geodir-map-listing-page', $output );
19
+	}
20 20
 
21
-    public function testDetailPageMap()
22
-    {
21
+	public function testDetailPageMap()
22
+	{
23 23
 
24
-        $query_args = array(
25
-            'post_status' => 'publish',
26
-            'post_type' => 'gd_place',
27
-            'posts_per_page' => 1,
28
-        );
24
+		$query_args = array(
25
+			'post_status' => 'publish',
26
+			'post_type' => 'gd_place',
27
+			'posts_per_page' => 1,
28
+		);
29 29
 
30
-        $all_posts = new WP_Query( $query_args );
31
-        $post_id = null;
32
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
33
-            $post_id = get_the_ID();
34
-            global $post;
35
-            $post =  geodir_get_post_info($post_id);
36
-            setup_postdata($post);
30
+		$all_posts = new WP_Query( $query_args );
31
+		$post_id = null;
32
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
33
+			$post_id = get_the_ID();
34
+			global $post;
35
+			$post =  geodir_get_post_info($post_id);
36
+			setup_postdata($post);
37 37
 
38
-            $map_args = array();
39
-            $map_args['map_canvas_name'] = 'detail_page_map_canvas';
40
-            $map_args['width'] = '600';
41
-            $map_args['height'] = '300';
42
-            if ($post->post_mapzoom) {
43
-                $map_args['zoom'] = '' . $post->post_mapzoom . '';
44
-            }
45
-            $map_args['autozoom'] = false;
46
-            $map_args['child_collapse'] = '0';
47
-            $map_args['enable_cat_filters'] = false;
48
-            $map_args['enable_text_search'] = false;
49
-            $map_args['enable_post_type_filters'] = false;
50
-            $map_args['enable_location_filters'] = false;
51
-            $map_args['enable_jason_on_load'] = true;
52
-            $map_args['enable_map_direction'] = true;
53
-            $map_args['map_class_name'] = 'geodir-map-detail-page';
54
-            $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
55
-            ob_start();
56
-            geodir_draw_map($map_args);
57
-            $output = ob_get_clean();
58
-            $this->assertContains( 'geodir-map-detail-page', $output );
59
-        endwhile;
38
+			$map_args = array();
39
+			$map_args['map_canvas_name'] = 'detail_page_map_canvas';
40
+			$map_args['width'] = '600';
41
+			$map_args['height'] = '300';
42
+			if ($post->post_mapzoom) {
43
+				$map_args['zoom'] = '' . $post->post_mapzoom . '';
44
+			}
45
+			$map_args['autozoom'] = false;
46
+			$map_args['child_collapse'] = '0';
47
+			$map_args['enable_cat_filters'] = false;
48
+			$map_args['enable_text_search'] = false;
49
+			$map_args['enable_post_type_filters'] = false;
50
+			$map_args['enable_location_filters'] = false;
51
+			$map_args['enable_jason_on_load'] = true;
52
+			$map_args['enable_map_direction'] = true;
53
+			$map_args['map_class_name'] = 'geodir-map-detail-page';
54
+			$map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
55
+			ob_start();
56
+			geodir_draw_map($map_args);
57
+			$output = ob_get_clean();
58
+			$this->assertContains( 'geodir-map-detail-page', $output );
59
+		endwhile;
60 60
 
61 61
 
62
-    }
62
+	}
63 63
 
64
-    public function tearDown()
65
-    {
66
-        parent::tearDown();
67
-    }
64
+	public function tearDown()
65
+	{
66
+		parent::tearDown();
67
+	}
68 68
 }
69 69
 ?>
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
     public function testCheckHomeMap()
10 10
     {
11 11
         $output = do_shortcode('[gd_homepage_map width=100% height=300 scrollwheel=false]');
12
-        $this->assertContains( 'geodir-map-home-page', $output );
12
+        $this->assertContains('geodir-map-home-page', $output);
13 13
     }
14 14
 
15 15
     public function testListingsPageMap()
16 16
     {
17 17
         $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]');
18
-        $this->assertContains( 'geodir-map-listing-page', $output );
18
+        $this->assertContains('geodir-map-listing-page', $output);
19 19
     }
20 20
 
21 21
     public function testDetailPageMap()
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
             'posts_per_page' => 1,
28 28
         );
29 29
 
30
-        $all_posts = new WP_Query( $query_args );
30
+        $all_posts = new WP_Query($query_args);
31 31
         $post_id = null;
32
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
32
+        while ($all_posts->have_posts()) : $all_posts->the_post();
33 33
             $post_id = get_the_ID();
34 34
             global $post;
35
-            $post =  geodir_get_post_info($post_id);
35
+            $post = geodir_get_post_info($post_id);
36 36
             setup_postdata($post);
37 37
 
38 38
             $map_args = array();
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             ob_start();
56 56
             geodir_draw_map($map_args);
57 57
             $output = ob_get_clean();
58
-            $this->assertContains( 'geodir-map-detail-page', $output );
58
+            $this->assertContains('geodir-map-detail-page', $output);
59 59
         endwhile;
60 60
 
61 61
 
Please login to merge, or discard this patch.
tests/test-Favourites.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -1,87 +1,87 @@
 block discarded – undo
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
-        $query_args = array(
15
-            'post_status' => 'publish',
16
-            'post_type' => 'gd_place',
17
-            'posts_per_page' => 1,
18
-        );
14
+		$query_args = array(
15
+			'post_status' => 'publish',
16
+			'post_type' => 'gd_place',
17
+			'posts_per_page' => 1,
18
+		);
19 19
 
20
-        $all_posts = new WP_Query( $query_args );
21
-        $post_id = null;
22
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
23
-            $post_id = get_the_ID();
24
-        endwhile;
20
+		$all_posts = new WP_Query( $query_args );
21
+		$post_id = null;
22
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
23
+			$post_id = get_the_ID();
24
+		endwhile;
25 25
 
26
-        $this->assertTrue(is_int($post_id));
26
+		$this->assertTrue(is_int($post_id));
27 27
 
28
-        ob_start();
29
-        geodir_add_to_favorite($post_id);
30
-        $output = ob_get_clean();
31
-        $this->assertContains( 'Remove from Favorites', $output );
28
+		ob_start();
29
+		geodir_add_to_favorite($post_id);
30
+		$output = ob_get_clean();
31
+		$this->assertContains( 'Remove from Favorites', $output );
32 32
 
33
-        $user_id = $current_user->ID;
33
+		$user_id = $current_user->ID;
34 34
 
35
-        $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
35
+		$user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
36 36
 
37
-        $this->assertContains( $post_id, $user_fav_posts );
37
+		$this->assertContains( $post_id, $user_fav_posts );
38 38
 
39 39
 
40
-    }
40
+	}
41 41
 
42
-    public function testRemoveFavourite()
43
-    {
44
-        global $current_user;
42
+	public function testRemoveFavourite()
43
+	{
44
+		global $current_user;
45 45
 
46
-        $query_args = array(
47
-            'post_status' => 'publish',
48
-            'post_type' => 'gd_place',
49
-            'posts_per_page' => 1,
50
-        );
46
+		$query_args = array(
47
+			'post_status' => 'publish',
48
+			'post_type' => 'gd_place',
49
+			'posts_per_page' => 1,
50
+		);
51 51
 
52
-        $all_posts = new WP_Query( $query_args );
53
-        $post_id = null;
54
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
55
-            $post_id = get_the_ID();
56
-        endwhile;
52
+		$all_posts = new WP_Query( $query_args );
53
+		$post_id = null;
54
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
55
+			$post_id = get_the_ID();
56
+		endwhile;
57 57
 
58
-        $this->assertTrue(is_int($post_id));
58
+		$this->assertTrue(is_int($post_id));
59 59
 
60
-        ob_start();
61
-        geodir_add_to_favorite($post_id);
62
-        $output = ob_get_clean();
63
-        $this->assertContains( 'Remove from Favorites', $output );
60
+		ob_start();
61
+		geodir_add_to_favorite($post_id);
62
+		$output = ob_get_clean();
63
+		$this->assertContains( 'Remove from Favorites', $output );
64 64
 
65
-        $user_id = $current_user->ID;
65
+		$user_id = $current_user->ID;
66 66
 
67
-        $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
67
+		$user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
68 68
 
69
-        $this->assertContains( $post_id, $user_fav_posts );
69
+		$this->assertContains( $post_id, $user_fav_posts );
70 70
 
71
-        ob_start();
72
-        geodir_remove_from_favorite($post_id);
73
-        $output = ob_get_clean();
74
-        $this->assertContains( 'Add to Favorites', $output );
71
+		ob_start();
72
+		geodir_remove_from_favorite($post_id);
73
+		$output = ob_get_clean();
74
+		$this->assertContains( 'Add to Favorites', $output );
75 75
 
76
-        $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
76
+		$user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
77 77
 
78
-        $this->assertNotContains( $post_id, $user_fav_posts );
79
-    }
78
+		$this->assertNotContains( $post_id, $user_fav_posts );
79
+	}
80 80
 
81 81
 
82
-    public function tearDown()
83
-    {
84
-        parent::tearDown();
85
-    }
82
+	public function tearDown()
83
+	{
84
+		parent::tearDown();
85
+	}
86 86
 }
87 87
 ?>
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
             'posts_per_page' => 1,
18 18
         );
19 19
 
20
-        $all_posts = new WP_Query( $query_args );
20
+        $all_posts = new WP_Query($query_args);
21 21
         $post_id = null;
22
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
22
+        while ($all_posts->have_posts()) : $all_posts->the_post();
23 23
             $post_id = get_the_ID();
24 24
         endwhile;
25 25
 
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
         ob_start();
29 29
         geodir_add_to_favorite($post_id);
30 30
         $output = ob_get_clean();
31
-        $this->assertContains( 'Remove from Favorites', $output );
31
+        $this->assertContains('Remove from Favorites', $output);
32 32
 
33 33
         $user_id = $current_user->ID;
34 34
 
35 35
         $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
36 36
 
37
-        $this->assertContains( $post_id, $user_fav_posts );
37
+        $this->assertContains($post_id, $user_fav_posts);
38 38
 
39 39
 
40 40
     }
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
             'posts_per_page' => 1,
50 50
         );
51 51
 
52
-        $all_posts = new WP_Query( $query_args );
52
+        $all_posts = new WP_Query($query_args);
53 53
         $post_id = null;
54
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
54
+        while ($all_posts->have_posts()) : $all_posts->the_post();
55 55
             $post_id = get_the_ID();
56 56
         endwhile;
57 57
 
@@ -60,22 +60,22 @@  discard block
 block discarded – undo
60 60
         ob_start();
61 61
         geodir_add_to_favorite($post_id);
62 62
         $output = ob_get_clean();
63
-        $this->assertContains( 'Remove from Favorites', $output );
63
+        $this->assertContains('Remove from Favorites', $output);
64 64
 
65 65
         $user_id = $current_user->ID;
66 66
 
67 67
         $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
68 68
 
69
-        $this->assertContains( $post_id, $user_fav_posts );
69
+        $this->assertContains($post_id, $user_fav_posts);
70 70
 
71 71
         ob_start();
72 72
         geodir_remove_from_favorite($post_id);
73 73
         $output = ob_get_clean();
74
-        $this->assertContains( 'Add to Favorites', $output );
74
+        $this->assertContains('Add to Favorites', $output);
75 75
 
76 76
         $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true);
77 77
 
78
-        $this->assertNotContains( $post_id, $user_fav_posts );
78
+        $this->assertNotContains($post_id, $user_fav_posts);
79 79
     }
80 80
 
81 81
 
Please login to merge, or discard this patch.
tests/test-Check_PinPoint.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 block discarded – undo
1 1
 <?php
2 2
 class CheckPinpoint extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+	}
8 8
 
9
-    public function testCheckPinpoint()
10
-    {
9
+	public function testCheckPinpoint()
10
+	{
11 11
 
12
-    }
12
+	}
13 13
 
14
-    public function tearDown()
15
-    {
16
-        parent::tearDown();
17
-    }
14
+	public function tearDown()
15
+	{
16
+		parent::tearDown();
17
+	}
18 18
 }
19 19
 ?>
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
tests/test-Add_A_Review.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,63 +1,63 @@
 block discarded – undo
1 1
 <?php
2 2
 class AddReview 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 testAddReview()
11
-    {
12
-        $time = current_time('mysql');
10
+	public function testAddReview()
11
+	{
12
+		$time = current_time('mysql');
13 13
 
14
-        $args = array(
15
-            'listing_type' => 'gd_place',
16
-            'post_title' => 'Test Listing Title',
17
-            'post_desc' => 'Test Desc',
18
-            'post_tags' => 'test1,test2',
19
-            'post_address' => 'New York City Hall',
20
-            'post_zip' => '10007',
21
-            'post_latitude' => '40.7127837',
22
-            'post_longitude' => '-74.00594130000002',
23
-            'post_mapview' => 'ROADMAP',
24
-            'post_mapzoom' => '10',
25
-            'geodir_timing' => '10.00 am to 6 pm every day',
26
-            'geodir_contact' => '1234567890',
27
-            'geodir_email' => '[email protected]',
28
-            'geodir_website' => 'http://test.com',
29
-            'geodir_twitter' => 'http://twitter.com/test',
30
-            'geodir_facebook' => 'http://facebook.com/test',
31
-            'geodir_special_offers' => 'Test offer'
32
-        );
33
-        $post_id = geodir_save_listing($args, true);
14
+		$args = array(
15
+			'listing_type' => 'gd_place',
16
+			'post_title' => 'Test Listing Title',
17
+			'post_desc' => 'Test Desc',
18
+			'post_tags' => 'test1,test2',
19
+			'post_address' => 'New York City Hall',
20
+			'post_zip' => '10007',
21
+			'post_latitude' => '40.7127837',
22
+			'post_longitude' => '-74.00594130000002',
23
+			'post_mapview' => 'ROADMAP',
24
+			'post_mapzoom' => '10',
25
+			'geodir_timing' => '10.00 am to 6 pm every day',
26
+			'geodir_contact' => '1234567890',
27
+			'geodir_email' => '[email protected]',
28
+			'geodir_website' => 'http://test.com',
29
+			'geodir_twitter' => 'http://twitter.com/test',
30
+			'geodir_facebook' => 'http://facebook.com/test',
31
+			'geodir_special_offers' => 'Test offer'
32
+		);
33
+		$post_id = geodir_save_listing($args, true);
34 34
 
35
-        $data = array(
36
-            'comment_post_ID' => $post_id,
37
-            'comment_author' => 'admin',
38
-            'comment_author_email' => '[email protected]',
39
-            'comment_author_url' => 'http://wpgeodirectory.com',
40
-            'comment_content' => 'content here',
41
-            'comment_type' => '',
42
-            'comment_parent' => 0,
43
-            'user_id' => 1,
44
-            'comment_author_IP' => '127.0.0.1',
45
-            '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)',
46
-            'comment_date' => $time,
47
-            'comment_approved' => 1,
48
-        );
35
+		$data = array(
36
+			'comment_post_ID' => $post_id,
37
+			'comment_author' => 'admin',
38
+			'comment_author_email' => '[email protected]',
39
+			'comment_author_url' => 'http://wpgeodirectory.com',
40
+			'comment_content' => 'content here',
41
+			'comment_type' => '',
42
+			'comment_parent' => 0,
43
+			'user_id' => 1,
44
+			'comment_author_IP' => '127.0.0.1',
45
+			'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)',
46
+			'comment_date' => $time,
47
+			'comment_approved' => 1,
48
+		);
49 49
 
50
-        $comment_id = wp_insert_comment($data);
50
+		$comment_id = wp_insert_comment($data);
51 51
 
52
-        $_REQUEST['geodir_overallrating'] = 5.0;
53
-        geodir_save_rating($comment_id);
52
+		$_REQUEST['geodir_overallrating'] = 5.0;
53
+		geodir_save_rating($comment_id);
54 54
 
55
-        $this->assertTrue(is_int($comment_id));
56
-    }
55
+		$this->assertTrue(is_int($comment_id));
56
+	}
57 57
 
58
-    public function tearDown()
59
-    {
60
-        parent::tearDown();
61
-    }
58
+	public function tearDown()
59
+	{
60
+		parent::tearDown();
61
+	}
62 62
 }
63 63
 ?>
64 64
\ No newline at end of file
Please login to merge, or discard this patch.
tests/test-Send_Enquiry.php 2 patches
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -1,116 +1,116 @@
 block discarded – undo
1 1
 <?php
2 2
 class SendEnquiry extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-    }
8
-
9
-    public function testSendEnquiry()
10
-    {
11
-        $query_args = array(
12
-            'post_status' => 'publish',
13
-            'post_type' => 'gd_place',
14
-            'posts_per_page' => 1,
15
-        );
16
-
17
-        $all_posts = new WP_Query( $query_args );
18
-        $post_id = null;
19
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
20
-            $post_id = get_the_ID();
21
-        endwhile;
22
-
23
-        $this->assertTrue(is_int($post_id));
24
-
25
-        $data = array(
26
-            'sendact' => 'send_inqury',
27
-            'pid' => (string) $post_id,
28
-            'inq_name' => 'Test User',
29
-            'inq_email' => '[email protected]',
30
-            'inq_phone' => 'Test',
31
-            'inq_msg' => 'Hi there, I would like to enquire about this place. I would like to ask more info about...',
32
-            'Send' => 'Send'
33
-        );
34
-
35
-        add_filter('wp_redirect', '__return_false');
36
-        geodir_send_inquiry($data);
37
-        remove_filter('wp_redirect', '__return_false');
38
-    }
39
-
40
-    public function testSendToFriend()
41
-    {
42
-        $query_args = array(
43
-            'post_status' => 'publish',
44
-            'post_type' => 'gd_place',
45
-            'posts_per_page' => 1,
46
-        );
47
-
48
-        $all_posts = new WP_Query( $query_args );
49
-        $post_id = null;
50
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
51
-            $post_id = get_the_ID();
52
-        endwhile;
53
-
54
-        $this->assertTrue(is_int($post_id));
55
-
56
-        $data = array(
57
-            'sendact' => 'email_frnd',
58
-            'pid' => (string) $post_id,
59
-            'yourname' => 'Test User',
60
-            'youremail' => '[email protected]',
61
-            'frnd_subject' => 'Test',
62
-            'frnd_comments' => 'Hi there, This is a comment',
63
-            'to_email' => '[email protected]',
64
-            'to_name' => 'Test User 2',
65
-            'Send' => 'Send'
66
-        );
67
-
68
-        add_filter('wp_redirect', '__return_false');
69
-        geodir_send_friend($data);
70
-        remove_filter('wp_redirect', '__return_false');
71
-    }
72
-
73
-    public function texstSendToFriendFailure()
74
-    {
75
-        $query_args = array(
76
-            'post_status' => 'publish',
77
-            'post_type' => 'gd_place',
78
-            'posts_per_page' => 1,
79
-        );
80
-
81
-        $all_posts = new WP_Query( $query_args );
82
-        $post_id = null;
83
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
84
-            $post_id = get_the_ID();
85
-        endwhile;
86
-
87
-        $this->assertTrue(is_int($post_id));
88
-
89
-        $data = array(
90
-            'sendact' => 'email_frnd',
91
-            'pid' => (string) $post_id,
92
-            'yourname' => 'Test User',
93
-            'youremail' => '[email protected]',
94
-            'frnd_subject' => 'Test',
95
-            'frnd_comments' => 'Hi there, This is a comment',
96
-            'to_email' => 'Test User 2', //incorrect email
97
-            'to_name' => '[email protected]',
98
-            'Send' => 'Send'
99
-        );
100
-
101
-        add_filter('wp_redirect', '__return_false');
102
-        add_filter('wp_mail', 'print_mail');
103
-        ob_start();
104
-        geodir_send_friend($data);
105
-        $output = ob_get_clean();
106
-        $this->assertContains( 'Email from GeoDirectory failed to send', $output );
107
-        remove_filter('wp_mail', 'print_mail');
108
-        remove_filter('wp_redirect', '__return_false');
109
-    }
110
-
111
-    public function tearDown()
112
-    {
113
-        parent::tearDown();
114
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+	}
8
+
9
+	public function testSendEnquiry()
10
+	{
11
+		$query_args = array(
12
+			'post_status' => 'publish',
13
+			'post_type' => 'gd_place',
14
+			'posts_per_page' => 1,
15
+		);
16
+
17
+		$all_posts = new WP_Query( $query_args );
18
+		$post_id = null;
19
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
20
+			$post_id = get_the_ID();
21
+		endwhile;
22
+
23
+		$this->assertTrue(is_int($post_id));
24
+
25
+		$data = array(
26
+			'sendact' => 'send_inqury',
27
+			'pid' => (string) $post_id,
28
+			'inq_name' => 'Test User',
29
+			'inq_email' => '[email protected]',
30
+			'inq_phone' => 'Test',
31
+			'inq_msg' => 'Hi there, I would like to enquire about this place. I would like to ask more info about...',
32
+			'Send' => 'Send'
33
+		);
34
+
35
+		add_filter('wp_redirect', '__return_false');
36
+		geodir_send_inquiry($data);
37
+		remove_filter('wp_redirect', '__return_false');
38
+	}
39
+
40
+	public function testSendToFriend()
41
+	{
42
+		$query_args = array(
43
+			'post_status' => 'publish',
44
+			'post_type' => 'gd_place',
45
+			'posts_per_page' => 1,
46
+		);
47
+
48
+		$all_posts = new WP_Query( $query_args );
49
+		$post_id = null;
50
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
51
+			$post_id = get_the_ID();
52
+		endwhile;
53
+
54
+		$this->assertTrue(is_int($post_id));
55
+
56
+		$data = array(
57
+			'sendact' => 'email_frnd',
58
+			'pid' => (string) $post_id,
59
+			'yourname' => 'Test User',
60
+			'youremail' => '[email protected]',
61
+			'frnd_subject' => 'Test',
62
+			'frnd_comments' => 'Hi there, This is a comment',
63
+			'to_email' => '[email protected]',
64
+			'to_name' => 'Test User 2',
65
+			'Send' => 'Send'
66
+		);
67
+
68
+		add_filter('wp_redirect', '__return_false');
69
+		geodir_send_friend($data);
70
+		remove_filter('wp_redirect', '__return_false');
71
+	}
72
+
73
+	public function texstSendToFriendFailure()
74
+	{
75
+		$query_args = array(
76
+			'post_status' => 'publish',
77
+			'post_type' => 'gd_place',
78
+			'posts_per_page' => 1,
79
+		);
80
+
81
+		$all_posts = new WP_Query( $query_args );
82
+		$post_id = null;
83
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
84
+			$post_id = get_the_ID();
85
+		endwhile;
86
+
87
+		$this->assertTrue(is_int($post_id));
88
+
89
+		$data = array(
90
+			'sendact' => 'email_frnd',
91
+			'pid' => (string) $post_id,
92
+			'yourname' => 'Test User',
93
+			'youremail' => '[email protected]',
94
+			'frnd_subject' => 'Test',
95
+			'frnd_comments' => 'Hi there, This is a comment',
96
+			'to_email' => 'Test User 2', //incorrect email
97
+			'to_name' => '[email protected]',
98
+			'Send' => 'Send'
99
+		);
100
+
101
+		add_filter('wp_redirect', '__return_false');
102
+		add_filter('wp_mail', 'print_mail');
103
+		ob_start();
104
+		geodir_send_friend($data);
105
+		$output = ob_get_clean();
106
+		$this->assertContains( 'Email from GeoDirectory failed to send', $output );
107
+		remove_filter('wp_mail', 'print_mail');
108
+		remove_filter('wp_redirect', '__return_false');
109
+	}
110
+
111
+	public function tearDown()
112
+	{
113
+		parent::tearDown();
114
+	}
115 115
 }
116 116
 ?>
117 117
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
             'posts_per_page' => 1,
15 15
         );
16 16
 
17
-        $all_posts = new WP_Query( $query_args );
17
+        $all_posts = new WP_Query($query_args);
18 18
         $post_id = null;
19
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
19
+        while ($all_posts->have_posts()) : $all_posts->the_post();
20 20
             $post_id = get_the_ID();
21 21
         endwhile;
22 22
 
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
             'posts_per_page' => 1,
46 46
         );
47 47
 
48
-        $all_posts = new WP_Query( $query_args );
48
+        $all_posts = new WP_Query($query_args);
49 49
         $post_id = null;
50
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
50
+        while ($all_posts->have_posts()) : $all_posts->the_post();
51 51
             $post_id = get_the_ID();
52 52
         endwhile;
53 53
 
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
             'posts_per_page' => 1,
79 79
         );
80 80
 
81
-        $all_posts = new WP_Query( $query_args );
81
+        $all_posts = new WP_Query($query_args);
82 82
         $post_id = null;
83
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
83
+        while ($all_posts->have_posts()) : $all_posts->the_post();
84 84
             $post_id = get_the_ID();
85 85
         endwhile;
86 86
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         ob_start();
104 104
         geodir_send_friend($data);
105 105
         $output = ob_get_clean();
106
-        $this->assertContains( 'Email from GeoDirectory failed to send', $output );
106
+        $this->assertContains('Email from GeoDirectory failed to send', $output);
107 107
         remove_filter('wp_mail', 'print_mail');
108 108
         remove_filter('wp_redirect', '__return_false');
109 109
     }
Please login to merge, or discard this patch.
tests/bootstrap.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,41 +3,41 @@  discard block
 block discarded – undo
3 3
 $_SERVER['SERVER_NAME'] = '';
4 4
 $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
5 5
 
6
-define( 'GD_USE_PHP_SESSIONS', false );
7
-define( 'GD_TESTING_MODE', true );
6
+define('GD_USE_PHP_SESSIONS', false);
7
+define('GD_TESTING_MODE', true);
8 8
 
9
-$_tests_dir = getenv( 'WP_TESTS_DIR' );
9
+$_tests_dir = getenv('WP_TESTS_DIR');
10 10
 
11
-if ( ! $_tests_dir ) {
12
-	$_tests_dir = dirname( __FILE__ )  . '/lib/wordpress-tests-lib';
11
+if (!$_tests_dir) {
12
+	$_tests_dir = dirname(__FILE__) . '/lib/wordpress-tests-lib';
13 13
 }
14 14
 
15 15
 require_once $_tests_dir . '/includes/functions.php';
16 16
 
17 17
 function _manually_load_plugin() {
18
-	require dirname( __FILE__ ) . '/../geodirectory.php';
18
+	require dirname(__FILE__) . '/../geodirectory.php';
19 19
 }
20
-tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
20
+tests_add_filter('muplugins_loaded', '_manually_load_plugin');
21 21
 
22 22
 function place_dummy_image_url($url) {
23
-	$gd_dummy_base_url = getenv( 'GD_DUMMY_BASE_URL' );
23
+	$gd_dummy_base_url = getenv('GD_DUMMY_BASE_URL');
24 24
 	if ($gd_dummy_base_url) {
25 25
 		return $gd_dummy_base_url;
26 26
 	} else {
27 27
 		return $url;
28 28
 	}
29 29
 }
30
-tests_add_filter( 'place_dummy_image_url', 'place_dummy_image_url' );
30
+tests_add_filter('place_dummy_image_url', 'place_dummy_image_url');
31 31
 
32 32
 function place_dummy_cat_image_url($url) {
33
-	$gd_dummy_base_url = getenv( 'GD_DUMMY_BASE_URL' );
33
+	$gd_dummy_base_url = getenv('GD_DUMMY_BASE_URL');
34 34
 	if ($gd_dummy_base_url) {
35
-		return $gd_dummy_base_url."/cat_icon";
35
+		return $gd_dummy_base_url . "/cat_icon";
36 36
 	} else {
37 37
 		return $url;
38 38
 	}
39 39
 }
40
-tests_add_filter( 'place_dummy_cat_image_url', 'place_dummy_cat_image_url' );
40
+tests_add_filter('place_dummy_cat_image_url', 'place_dummy_cat_image_url');
41 41
 
42 42
 
43 43
 require $_tests_dir . '/includes/bootstrap.php';
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
 global $current_user;
46 46
 $current_user = new WP_User(1);
47 47
 $current_user->set_role('administrator');
48
-wp_update_user( array( 'ID' => 1, 'first_name' => 'Admin', 'last_name' => 'User' ) );
48
+wp_update_user(array('ID' => 1, 'first_name' => 'Admin', 'last_name' => 'User'));
49 49
 //Add subscriber
50
-wp_create_user( 'testuser', '12345', '[email protected]' );
50
+wp_create_user('testuser', '12345', '[email protected]');
51 51
 
52 52
 echo "Activating GeoDirectory...\n";
53
-activate_plugin( 'geodirectory/geodirectory.php' );
53
+activate_plugin('geodirectory/geodirectory.php');
54 54
 
55 55
 echo "Installing GeoDirectory...\n";
56 56
 geodir_install();
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 //	unset($_REQUEST['_wpnonce']);
122 122
 
123 123
 	$i = 2;
124
-	while($i <= $max) {
124
+	while ($i <= $max) {
125 125
 		global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
126 126
 
127 127
 		$dummy_post_index = $i;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		$city_bound_lat2 = 40.91525559999999;
131 131
 		$city_bound_lng2 = -73.7002721;
132 132
 
133
-		include dirname( __FILE__ ) . '/../geodirectory-admin/place_dummy_post.php';
133
+		include dirname(__FILE__) . '/../geodirectory-admin/place_dummy_post.php';
134 134
 		$i++;
135 135
 	}
136 136
 }
Please login to merge, or discard this patch.
tests/test-Author_Page.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 block discarded – undo
1 1
 <?php
2 2
 class AuthorPage extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+	}
8 8
 
9
-    public function testAuthorPage()
10
-    {
9
+	public function testAuthorPage()
10
+	{
11 11
 
12
-    }
12
+	}
13 13
 
14
-    public function tearDown()
15
-    {
16
-        parent::tearDown();
17
-    }
14
+	public function tearDown()
15
+	{
16
+		parent::tearDown();
17
+	}
18 18
 }
19 19
 ?>
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
tests/lib/wordpress-tests-lib/wp-tests-config.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
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,18 +21,18 @@  discard block
 block discarded – undo
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( 'WPLANG', '' );
38
-$table_prefix  = 'wptests_';
39 37
\ No newline at end of file
38
+define('WPLANG', '');
39
+$table_prefix = 'wptests_';
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
tests/lib/wordpress-tests-lib/includes/wp-profiler.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		// reset the wpdb queries log, storing it on the profile stack if necessary
41 41
 		global $wpdb;
42 42
 		if ($this->stack) {
43
-			$this->stack[count($this->stack)-1]['queries'] = $wpdb->queries;
43
+			$this->stack[count($this->stack) - 1]['queries'] = $wpdb->queries;
44 44
 		}
45 45
 		$wpdb->queries = array();
46 46
 
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 
75 75
 		if (isset($this->profile[$name])) {
76 76
 			$this->profile[$name]['time'] += $time;
77
-			$this->profile[$name]['calls'] ++;
77
+			$this->profile[$name]['calls']++;
78 78
 			$this->profile[$name]['cache_cold_hits'] += ($wp_object_cache->cold_cache_hits - $item['cache_cold_hits']);
79 79
 			$this->profile[$name]['cache_warm_hits'] += ($wp_object_cache->warm_cache_hits - $item['cache_warm_hits']);
80 80
 			$this->profile[$name]['cache_misses'] += ($wp_object_cache->cache_misses - $item['cache_misses']);
81
-			$this->profile[$name]['cache_dirty_objects'] = array_add( $this->profile[$name]['cache_dirty_objects'], $cache_dirty_delta) ;
82
-			$this->profile[$name]['actions'] = array_add( $this->profile[$name]['actions'], $item['actions'] );
83
-			$this->profile[$name]['filters'] = array_add( $this->profile[$name]['filters'], $item['filters'] );
84
-			$this->profile[$name]['queries'] = array_add( $this->profile[$name]['queries'], $item['queries'] );
81
+			$this->profile[$name]['cache_dirty_objects'] = array_add($this->profile[$name]['cache_dirty_objects'], $cache_dirty_delta);
82
+			$this->profile[$name]['actions'] = array_add($this->profile[$name]['actions'], $item['actions']);
83
+			$this->profile[$name]['filters'] = array_add($this->profile[$name]['filters'], $item['filters']);
84
+			$this->profile[$name]['queries'] = array_add($this->profile[$name]['queries'], $item['queries']);
85 85
 			#$this->_query_summary($item['queries'], $this->profile[$name]['queries']);
86 86
 
87 87
 		}
@@ -109,28 +109,28 @@  discard block
 block discarded – undo
109 109
 
110 110
 	function microtime($since = 0.0) {
111 111
 		list($usec, $sec) = explode(' ', microtime());
112
-		return (float)$sec + (float)$usec - $since;
112
+		return (float) $sec + (float) $usec - $since;
113 113
 	}
114 114
 
115 115
 	function log_filter($tag) {
116 116
 		if ($this->stack) {
117 117
 			global $wp_actions;
118 118
 			if ($tag == end($wp_actions))
119
-				@$this->stack[count($this->stack)-1]['actions'][$tag] ++;
119
+				@$this->stack[count($this->stack) - 1]['actions'][$tag]++;
120 120
 			else
121
-				@$this->stack[count($this->stack)-1]['filters'][$tag] ++;
121
+				@$this->stack[count($this->stack) - 1]['filters'][$tag]++;
122 122
 		}
123 123
 		return $arg;
124 124
 	}
125 125
 
126 126
 	function log_action($tag) {
127 127
 		if ($this->stack)
128
-			@$this->stack[count($this->stack)-1]['actions'][$tag] ++;
128
+			@$this->stack[count($this->stack) - 1]['actions'][$tag]++;
129 129
 	}
130 130
 
131 131
 	function _current_action() {
132 132
 		global $wp_actions;
133
-		return $wp_actions[count($wp_actions)-1];
133
+		return $wp_actions[count($wp_actions) - 1];
134 134
 	}
135 135
 
136 136
 	function results() {
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 			$sql = preg_replace('/(WHERE \w+ =) \d+/', '$1 x', $sql);
144 144
 			$sql = preg_replace('/(WHERE \w+ =) \'\[-\w]+\'/', '$1 \'xxx\'', $sql);
145 145
 
146
-			@$out[$sql] ++;
146
+			@$out[$sql]++;
147 147
 		}
148 148
 		asort($out);
149 149
 		return;
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
 		$out = array();
155 155
 		foreach ($queries as $q) {
156 156
 			if (empty($q[2]))
157
-				@$out['unknown'] ++;
157
+				@$out['unknown']++;
158 158
 			else
159
-				@$out[$q[2]] ++;
159
+				@$out[$q[2]]++;
160 160
 		}
161 161
 		return $out;
162 162
 	}
Please login to merge, or discard this patch.
Braces   +26 added lines, -20 removed lines patch added patch discarded remove patch
@@ -84,8 +84,7 @@  discard block
 block discarded – undo
84 84
 			$this->profile[$name]['queries'] = array_add( $this->profile[$name]['queries'], $item['queries'] );
85 85
 			#$this->_query_summary($item['queries'], $this->profile[$name]['queries']);
86 86
 
87
-		}
88
-		else {
87
+		} else {
89 88
 			$queries = array();
90 89
 			$this->_query_summary($item['queries'], $queries);
91 90
 			$this->profile[$name] = array(
@@ -115,17 +114,19 @@  discard block
 block discarded – undo
115 114
 	function log_filter($tag) {
116 115
 		if ($this->stack) {
117 116
 			global $wp_actions;
118
-			if ($tag == end($wp_actions))
119
-				@$this->stack[count($this->stack)-1]['actions'][$tag] ++;
120
-			else
121
-				@$this->stack[count($this->stack)-1]['filters'][$tag] ++;
117
+			if ($tag == end($wp_actions)) {
118
+							@$this->stack[count($this->stack)-1]['actions'][$tag] ++;
119
+			} else {
120
+							@$this->stack[count($this->stack)-1]['filters'][$tag] ++;
121
+			}
122 122
 		}
123 123
 		return $arg;
124 124
 	}
125 125
 
126 126
 	function log_action($tag) {
127
-		if ($this->stack)
128
-			@$this->stack[count($this->stack)-1]['actions'][$tag] ++;
127
+		if ($this->stack) {
128
+					@$this->stack[count($this->stack)-1]['actions'][$tag] ++;
129
+		}
129 130
 	}
130 131
 
131 132
 	function _current_action() {
@@ -153,36 +154,41 @@  discard block
 block discarded – undo
153 154
 		// this requires the savequeries patch at https://core.trac.wordpress.org/ticket/5218
154 155
 		$out = array();
155 156
 		foreach ($queries as $q) {
156
-			if (empty($q[2]))
157
-				@$out['unknown'] ++;
158
-			else
159
-				@$out[$q[2]] ++;
157
+			if (empty($q[2])) {
158
+							@$out['unknown'] ++;
159
+			} else {
160
+							@$out[$q[2]] ++;
161
+			}
160 162
 		}
161 163
 		return $out;
162 164
 	}
163 165
 
164 166
 	function _dirty_objects_count($dirty_objects) {
165 167
 		$out = array();
166
-		foreach (array_keys($dirty_objects) as $group)
167
-			$out[$group] = count($dirty_objects[$group]);
168
+		foreach (array_keys($dirty_objects) as $group) {
169
+					$out[$group] = count($dirty_objects[$group]);
170
+		}
168 171
 		return $out;
169 172
 	}
170 173
 
171 174
 	function array_add($a, $b) {
172 175
 		$out = $a;
173
-		foreach (array_keys($b) as $key)
174
-			if (array_key_exists($key, $out))
176
+		foreach (array_keys($b) as $key) {
177
+					if (array_key_exists($key, $out))
175 178
 				$out[$key] += $b[$key];
176
-			else
177
-				$out[$key] = $b[$key];
179
+		}
180
+			else {
181
+							$out[$key] = $b[$key];
182
+			}
178 183
 		return $out;
179 184
 	}
180 185
 
181 186
 	function array_sub($a, $b) {
182 187
 		$out = $a;
183
-		foreach (array_keys($b) as $key)
184
-			if (array_key_exists($key, $b))
188
+		foreach (array_keys($b) as $key) {
189
+					if (array_key_exists($key, $b))
185 190
 				$out[$key] -= $b[$key];
191
+		}
186 192
 		return $out;
187 193
 	}
188 194
 
Please login to merge, or discard this patch.