Passed
Pull Request — master (#220)
by Viruthagiri
11:11
created
tests/lib/wordpress-tests-lib/includes/trac.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -13,35 +13,35 @@
 block discarded – undo
13 13
 	 *
14 14
 	 * @return bool|null true if the ticket is resolved, false if not resolved, null on error
15 15
 	 */
16
-	public static function isTracTicketClosed( $trac_url, $ticket_id ) {
17
-		if ( ! extension_loaded( 'openssl' ) ) {
18
-			$trac_url = preg_replace( "/^https:/", "http:", $trac_url );
16
+	public static function isTracTicketClosed($trac_url, $ticket_id) {
17
+		if (!extension_loaded('openssl')) {
18
+			$trac_url = preg_replace("/^https:/", "http:", $trac_url);
19 19
 		}
20 20
 
21
-		if ( ! isset( self::$trac_ticket_cache[ $trac_url ] ) ) {
21
+		if (!isset(self::$trac_ticket_cache[$trac_url])) {
22 22
 			// In case you're running the tests offline, keep track of open tickets.
23
-			$file = DIR_TESTDATA . '/.trac-ticket-cache.' . str_replace( array( 'http://', 'https://', '/' ), array( '', '', '-' ), rtrim( $trac_url, '/' ) );
24
-			$tickets = @file_get_contents( $trac_url . '/query?status=%21closed&format=csv&col=id' );
23
+			$file = DIR_TESTDATA . '/.trac-ticket-cache.' . str_replace(array('http://', 'https://', '/'), array('', '', '-'), rtrim($trac_url, '/'));
24
+			$tickets = @file_get_contents($trac_url . '/query?status=%21closed&format=csv&col=id');
25 25
 			// Check if our HTTP request failed.
26
-			if ( false === $tickets ) {
27
-				if ( file_exists( $file ) ) {
28
-					register_shutdown_function( array( 'TracTickets', 'usingLocalCache' ) );
29
-					$tickets = file_get_contents( $file );
26
+			if (false === $tickets) {
27
+				if (file_exists($file)) {
28
+					register_shutdown_function(array('TracTickets', 'usingLocalCache'));
29
+					$tickets = file_get_contents($file);
30 30
 				} else {
31
-					register_shutdown_function( array( 'TracTickets', 'forcingKnownBugs' ) );
32
-					self::$trac_ticket_cache[ $trac_url ] = array();
31
+					register_shutdown_function(array('TracTickets', 'forcingKnownBugs'));
32
+					self::$trac_ticket_cache[$trac_url] = array();
33 33
 					return true; // Assume the ticket is closed, which means it gets run.
34 34
 				}
35 35
 			} else {
36
-				$tickets = substr( $tickets, 2 ); // remove 'id' column header
37
-				$tickets = trim( $tickets );
38
-				file_put_contents( $file, $tickets );
36
+				$tickets = substr($tickets, 2); // remove 'id' column header
37
+				$tickets = trim($tickets);
38
+				file_put_contents($file, $tickets);
39 39
 			}
40
-			$tickets = explode( "\r\n", $tickets );
41
-			self::$trac_ticket_cache[ $trac_url ] = $tickets;
40
+			$tickets = explode("\r\n", $tickets);
41
+			self::$trac_ticket_cache[$trac_url] = $tickets;
42 42
 		}
43 43
 
44
-		return ! in_array( $ticket_id, self::$trac_ticket_cache[ $trac_url ] );
44
+		return !in_array($ticket_id, self::$trac_ticket_cache[$trac_url]);
45 45
 	}
46 46
 
47 47
 	public static function usingLocalCache() {
Please login to merge, or discard this patch.
tests/test-Search_With_Keyword.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,38 +1,38 @@
 block discarded – undo
1 1
 <?php
2 2
 class SearchWithKeyword 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 testSearchWithKeyword()
10
-    {
11
-        $_REQUEST['geodir_search'] = 1;
12
-        $query_args = array(
13
-            'post_status' => 'publish',
14
-            'post_type' => 'gd_place',
15
-            'posts_per_page' => 1,
16
-            's' => 'Longwood Gardens'
17
-        );
9
+	public function testSearchWithKeyword()
10
+	{
11
+		$_REQUEST['geodir_search'] = 1;
12
+		$query_args = array(
13
+			'post_status' => 'publish',
14
+			'post_type' => 'gd_place',
15
+			'posts_per_page' => 1,
16
+			's' => 'Longwood Gardens'
17
+		);
18 18
 
19
-        $all_posts = new WP_Query( $query_args );
19
+		$all_posts = new WP_Query( $query_args );
20 20
 
21
-        $total_posts = $all_posts->found_posts;
21
+		$total_posts = $all_posts->found_posts;
22 22
 
23
-        $this->assertTrue(is_int((int) $total_posts));
23
+		$this->assertTrue(is_int((int) $total_posts));
24 24
 
25
-        $title = null;
26
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
27
-            $title = get_the_title();
28
-        endwhile;
25
+		$title = null;
26
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
27
+			$title = get_the_title();
28
+		endwhile;
29 29
 
30
-        $this->assertEquals($title, 'Longwood Gardens');
31
-    }
30
+		$this->assertEquals($title, 'Longwood Gardens');
31
+	}
32 32
 
33
-    public function tearDown()
34
-    {
35
-        parent::tearDown();
36
-    }
33
+	public function tearDown()
34
+	{
35
+		parent::tearDown();
36
+	}
37 37
 }
38 38
 ?>
39 39
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@
 block discarded – undo
15 15
             'posts_per_page' => 1,
16 16
         );
17 17
 
18
-        $all_posts = new WP_Query( $query_args );
18
+        $all_posts = new WP_Query($query_args);
19 19
         $post_id = null;
20
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
20
+        while ($all_posts->have_posts()) : $all_posts->the_post();
21 21
             $post_id = get_the_ID();
22 22
         endwhile;
23 23
 
Please login to merge, or discard this patch.
tests/test-Add_Listing.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,39 +1,39 @@
 block discarded – undo
1 1
 <?php
2 2
 class AddListing 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 testAddListing()
11
-    {
12
-        $args = array(
13
-            'listing_type' => 'gd_place',
14
-            'post_title' => 'Test Listing Title',
15
-            'post_desc' => 'Test Desc',
16
-            'post_tags' => 'test1,test2',
17
-            'post_address' => 'New York City Hall',
18
-            'post_zip' => '10007',
19
-            'post_mapview' => 'ROADMAP',
20
-            'post_mapzoom' => '10',
21
-            'geodir_timing' => '10.00 am to 6 pm every day',
22
-            'geodir_contact' => '1234567890',
23
-            'geodir_email' => '[email protected]',
24
-            'geodir_website' => 'http://test.com',
25
-            'geodir_twitter' => 'http://twitter.com/test',
26
-            'geodir_facebook' => 'http://facebook.com/test',
27
-            'geodir_special_offers' => 'Test offer'
28
-        );
29
-        $post_id = geodir_save_listing($args, true);
10
+	public function testAddListing()
11
+	{
12
+		$args = array(
13
+			'listing_type' => 'gd_place',
14
+			'post_title' => 'Test Listing Title',
15
+			'post_desc' => 'Test Desc',
16
+			'post_tags' => 'test1,test2',
17
+			'post_address' => 'New York City Hall',
18
+			'post_zip' => '10007',
19
+			'post_mapview' => 'ROADMAP',
20
+			'post_mapzoom' => '10',
21
+			'geodir_timing' => '10.00 am to 6 pm every day',
22
+			'geodir_contact' => '1234567890',
23
+			'geodir_email' => '[email protected]',
24
+			'geodir_website' => 'http://test.com',
25
+			'geodir_twitter' => 'http://twitter.com/test',
26
+			'geodir_facebook' => 'http://facebook.com/test',
27
+			'geodir_special_offers' => 'Test offer'
28
+		);
29
+		$post_id = geodir_save_listing($args, true);
30 30
 
31
-        $this->assertTrue(is_int($post_id));
32
-    }
31
+		$this->assertTrue(is_int($post_id));
32
+	}
33 33
 
34
-    public function tearDown()
35
-    {
36
-        parent::tearDown();
37
-    }
34
+	public function tearDown()
35
+	{
36
+		parent::tearDown();
37
+	}
38 38
 }
39 39
 ?>
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
tests/test-Check_Login_Box.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,57 +1,57 @@
 block discarded – undo
1 1
 <?php
2 2
 class CheckLoginBox 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 testLoginBoxEmptyPassword()
10
-    {
11
-        global $errors;
12
-        $_POST['testcookie'] = 1;
13
-        $_POST['log'] = 'admin';
14
-        add_filter('wp_redirect', '__return_false');
15
-        geodir_user_signup();
16
-        remove_filter('wp_redirect', '__return_false');
17
-        $errors = (array) $errors;
18
-        $this->assertArrayHasKey( 'empty_password', $errors["errors"] );
19
-        $this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] );
20
-    }
9
+	public function testLoginBoxEmptyPassword()
10
+	{
11
+		global $errors;
12
+		$_POST['testcookie'] = 1;
13
+		$_POST['log'] = 'admin';
14
+		add_filter('wp_redirect', '__return_false');
15
+		geodir_user_signup();
16
+		remove_filter('wp_redirect', '__return_false');
17
+		$errors = (array) $errors;
18
+		$this->assertArrayHasKey( 'empty_password', $errors["errors"] );
19
+		$this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] );
20
+	}
21 21
 
22
-    public function testLoginBoxIncorrectPassword()
23
-    {
24
-        global $errors;
25
-        $_POST['testcookie'] = 1;
26
-        $_REQUEST['action'] = 'login';
27
-        $_POST['log'] = 'testuser';
28
-        $_POST['pwd'] = 'admin';
29
-        add_filter('wp_redirect', '__return_false');
30
-        geodir_user_signup();
31
-        remove_filter('wp_redirect', '__return_false');
32
-        $errors = (array) $errors;
33
-        $this->assertArrayHasKey( 'incorrect_password', $errors["errors"] );
34
-        $this->assertContains( 'The password you entered for the username', $errors["errors"]["incorrect_password"][0] );
35
-    }
22
+	public function testLoginBoxIncorrectPassword()
23
+	{
24
+		global $errors;
25
+		$_POST['testcookie'] = 1;
26
+		$_REQUEST['action'] = 'login';
27
+		$_POST['log'] = 'testuser';
28
+		$_POST['pwd'] = 'admin';
29
+		add_filter('wp_redirect', '__return_false');
30
+		geodir_user_signup();
31
+		remove_filter('wp_redirect', '__return_false');
32
+		$errors = (array) $errors;
33
+		$this->assertArrayHasKey( 'incorrect_password', $errors["errors"] );
34
+		$this->assertContains( 'The password you entered for the username', $errors["errors"]["incorrect_password"][0] );
35
+	}
36 36
 
37
-    public function testLoginBoxInvalidUsername()
38
-    {
39
-        global $errors;
40
-        $_POST['testcookie'] = 1;
41
-        $_REQUEST['action'] = 'login';
42
-        $_POST['log'] = 'adm##@in';
43
-        $_POST['pwd'] = 'admin';
44
-        add_filter('wp_redirect', '__return_false');
45
-        geodir_user_signup();
46
-        remove_filter('wp_redirect', '__return_false');
47
-        $errors = (array) $errors;
48
-        $this->assertArrayHasKey( 'invalid_username', $errors["errors"] );
49
-        $this->assertContains( 'Invalid username', $errors["errors"]["invalid_username"][0] );
50
-    }
37
+	public function testLoginBoxInvalidUsername()
38
+	{
39
+		global $errors;
40
+		$_POST['testcookie'] = 1;
41
+		$_REQUEST['action'] = 'login';
42
+		$_POST['log'] = 'adm##@in';
43
+		$_POST['pwd'] = 'admin';
44
+		add_filter('wp_redirect', '__return_false');
45
+		geodir_user_signup();
46
+		remove_filter('wp_redirect', '__return_false');
47
+		$errors = (array) $errors;
48
+		$this->assertArrayHasKey( 'invalid_username', $errors["errors"] );
49
+		$this->assertContains( 'Invalid username', $errors["errors"]["invalid_username"][0] );
50
+	}
51 51
 
52
-    public function tearDown()
53
-    {
54
-        parent::tearDown();
55
-    }
52
+	public function tearDown()
53
+	{
54
+		parent::tearDown();
55
+	}
56 56
 }
57 57
 ?>
58 58
\ 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
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
         geodir_user_signup();
16 16
         remove_filter('wp_redirect', '__return_false');
17 17
         $errors = (array) $errors;
18
-        $this->assertArrayHasKey( 'empty_password', $errors["errors"] );
19
-        $this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] );
18
+        $this->assertArrayHasKey('empty_password', $errors["errors"]);
19
+        $this->assertContains('The password field is empty', $errors["errors"]["empty_password"][0]);
20 20
     }
21 21
 
22 22
     public function testLoginBoxIncorrectPassword()
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
         geodir_user_signup();
31 31
         remove_filter('wp_redirect', '__return_false');
32 32
         $errors = (array) $errors;
33
-        $this->assertArrayHasKey( 'incorrect_password', $errors["errors"] );
34
-        $this->assertContains( 'The password you entered for the username', $errors["errors"]["incorrect_password"][0] );
33
+        $this->assertArrayHasKey('incorrect_password', $errors["errors"]);
34
+        $this->assertContains('The password you entered for the username', $errors["errors"]["incorrect_password"][0]);
35 35
     }
36 36
 
37 37
     public function testLoginBoxInvalidUsername()
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
         geodir_user_signup();
46 46
         remove_filter('wp_redirect', '__return_false');
47 47
         $errors = (array) $errors;
48
-        $this->assertArrayHasKey( 'invalid_username', $errors["errors"] );
49
-        $this->assertContains( 'Invalid username', $errors["errors"]["invalid_username"][0] );
48
+        $this->assertArrayHasKey('invalid_username', $errors["errors"]);
49
+        $this->assertContains('Invalid username', $errors["errors"]["invalid_username"][0]);
50 50
     }
51 51
 
52 52
     public function tearDown()
Please login to merge, or discard this patch.
tests/test-Login.php 2 patches
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -1,52 +1,52 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 class LoginUser extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-        deactivate_plugins('buddypress/bp-loader.php');
8
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+		deactivate_plugins('buddypress/bp-loader.php');
8
+	}
9 9
 
10
-    public function testLoginEmptyPassword()
11
-    {
12
-        global $errors;
13
-        $_REQUEST['action'] = 'login';
14
-        $_POST['log'] = 'admin';
15
-        add_filter('wp_redirect', '__return_false');
16
-        geodir_user_signup();
17
-        remove_filter('wp_redirect', '__return_false');
18
-        $errors = (array) $errors;
19
-        $this->assertArrayHasKey( 'empty_password', $errors["errors"] );
20
-        $this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] );
21
-    }
10
+	public function testLoginEmptyPassword()
11
+	{
12
+		global $errors;
13
+		$_REQUEST['action'] = 'login';
14
+		$_POST['log'] = 'admin';
15
+		add_filter('wp_redirect', '__return_false');
16
+		geodir_user_signup();
17
+		remove_filter('wp_redirect', '__return_false');
18
+		$errors = (array) $errors;
19
+		$this->assertArrayHasKey( 'empty_password', $errors["errors"] );
20
+		$this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] );
21
+	}
22 22
 
23
-    public function testLoginIncorrectPassword()
24
-    {
25
-        global $errors;
26
-        $_REQUEST['action'] = 'login';
27
-        $_POST['log'] = 'testuser';
28
-        $_POST['pwd'] = 'admin';
29
-        add_filter('wp_redirect', '__return_false');
30
-        geodir_user_signup();
31
-        remove_filter('wp_redirect', '__return_false');
32
-        $errors = (array) $errors;
33
-        $this->assertArrayHasKey( 'incorrect_password', $errors["errors"] );
34
-        $this->assertContains( 'The password you entered for the username', $errors["errors"]["incorrect_password"][0] );
35
-    }
23
+	public function testLoginIncorrectPassword()
24
+	{
25
+		global $errors;
26
+		$_REQUEST['action'] = 'login';
27
+		$_POST['log'] = 'testuser';
28
+		$_POST['pwd'] = 'admin';
29
+		add_filter('wp_redirect', '__return_false');
30
+		geodir_user_signup();
31
+		remove_filter('wp_redirect', '__return_false');
32
+		$errors = (array) $errors;
33
+		$this->assertArrayHasKey( 'incorrect_password', $errors["errors"] );
34
+		$this->assertContains( 'The password you entered for the username', $errors["errors"]["incorrect_password"][0] );
35
+	}
36 36
 
37
-    public function testLoginInvalidUsername()
38
-    {
39
-        global $errors;
40
-        $_REQUEST['action'] = 'login';
41
-        $_POST['log'] = 'adm##@in';
42
-        $_POST['pwd'] = 'admin';
43
-        add_filter('wp_redirect', '__return_false');
44
-        geodir_user_signup();
45
-        remove_filter('wp_redirect', '__return_false');
46
-        $errors = (array) $errors;
47
-        $this->assertArrayHasKey( 'invalid_username', $errors["errors"] );
48
-        $this->assertContains( 'Invalid username', $errors["errors"]["invalid_username"][0] );
49
-    }
37
+	public function testLoginInvalidUsername()
38
+	{
39
+		global $errors;
40
+		$_REQUEST['action'] = 'login';
41
+		$_POST['log'] = 'adm##@in';
42
+		$_POST['pwd'] = 'admin';
43
+		add_filter('wp_redirect', '__return_false');
44
+		geodir_user_signup();
45
+		remove_filter('wp_redirect', '__return_false');
46
+		$errors = (array) $errors;
47
+		$this->assertArrayHasKey( 'invalid_username', $errors["errors"] );
48
+		$this->assertContains( 'Invalid username', $errors["errors"]["invalid_username"][0] );
49
+	}
50 50
 
51 51
 //    public function testLoginValid()
52 52
 //    {
@@ -59,55 +59,55 @@  discard block
 block discarded – undo
59 59
 //        remove_filter('wp_redirect', '__return_false');
60 60
 //    }
61 61
 
62
-    public function testForgotPassEmptyData()
63
-    {
64
-        global $errors;
65
-        $_SERVER['REQUEST_METHOD'] = 'POST';
66
-        $_REQUEST['action'] = 'retrievepassword';
67
-        $_POST['user_login'] = '';
68
-        $_POST['user_email'] = '';
69
-        add_filter('wp_redirect', '__return_false');
70
-        geodir_user_signup();
71
-        remove_filter('wp_redirect', '__return_false');
72
-        $errors = (array) $errors;
73
-        $this->assertArrayHasKey( 'empty_username', $errors["errors"] );
74
-        $this->assertContains( 'Enter a username or e-mail address', $errors["errors"]["empty_username"][0] );
75
-    }
62
+	public function testForgotPassEmptyData()
63
+	{
64
+		global $errors;
65
+		$_SERVER['REQUEST_METHOD'] = 'POST';
66
+		$_REQUEST['action'] = 'retrievepassword';
67
+		$_POST['user_login'] = '';
68
+		$_POST['user_email'] = '';
69
+		add_filter('wp_redirect', '__return_false');
70
+		geodir_user_signup();
71
+		remove_filter('wp_redirect', '__return_false');
72
+		$errors = (array) $errors;
73
+		$this->assertArrayHasKey( 'empty_username', $errors["errors"] );
74
+		$this->assertContains( 'Enter a username or e-mail address', $errors["errors"]["empty_username"][0] );
75
+	}
76 76
 
77
-    public function testForgotPassInvalidEmail()
78
-    {
79
-        global $errors;
80
-        $_SERVER['REQUEST_METHOD'] = 'POST';
81
-        $_REQUEST['action'] = 'retrievepassword';
82
-        $_POST['user_login'] = '[email protected]';
83
-        $_POST['user_email'] = '';
84
-        add_filter('wp_redirect', '__return_false');
85
-        geodir_user_signup();
86
-        remove_filter('wp_redirect', '__return_false');
87
-        $errors = (array) $errors;
88
-        $this->assertArrayHasKey( 'invalid_email', $errors["errors"] );
89
-        $this->assertContains( 'There is no user registered with that email address', $errors["errors"]["invalid_email"][0] );
90
-    }
77
+	public function testForgotPassInvalidEmail()
78
+	{
79
+		global $errors;
80
+		$_SERVER['REQUEST_METHOD'] = 'POST';
81
+		$_REQUEST['action'] = 'retrievepassword';
82
+		$_POST['user_login'] = '[email protected]';
83
+		$_POST['user_email'] = '';
84
+		add_filter('wp_redirect', '__return_false');
85
+		geodir_user_signup();
86
+		remove_filter('wp_redirect', '__return_false');
87
+		$errors = (array) $errors;
88
+		$this->assertArrayHasKey( 'invalid_email', $errors["errors"] );
89
+		$this->assertContains( 'There is no user registered with that email address', $errors["errors"]["invalid_email"][0] );
90
+	}
91 91
 
92
-    public function testForgotPassInvalidUsername()
93
-    {
94
-        global $errors;
95
-        $_SERVER['REQUEST_METHOD'] = 'POST';
96
-        $_REQUEST['action'] = 'retrievepassword';
97
-        $_POST['user_login'] = 'holla';
98
-        $_POST['user_email'] = '[email protected]';
99
-        add_filter('wp_redirect', '__return_false');
100
-        geodir_user_signup();
101
-        remove_filter('wp_redirect', '__return_false');
102
-        $errors = (array) $errors;
103
-        $this->assertArrayHasKey( 'invalidcombo', $errors["errors"] );
104
-        $this->assertContains( 'Invalid username or e-mail', $errors["errors"]["invalidcombo"][0] );
105
-    }
92
+	public function testForgotPassInvalidUsername()
93
+	{
94
+		global $errors;
95
+		$_SERVER['REQUEST_METHOD'] = 'POST';
96
+		$_REQUEST['action'] = 'retrievepassword';
97
+		$_POST['user_login'] = 'holla';
98
+		$_POST['user_email'] = '[email protected]';
99
+		add_filter('wp_redirect', '__return_false');
100
+		geodir_user_signup();
101
+		remove_filter('wp_redirect', '__return_false');
102
+		$errors = (array) $errors;
103
+		$this->assertArrayHasKey( 'invalidcombo', $errors["errors"] );
104
+		$this->assertContains( 'Invalid username or e-mail', $errors["errors"]["invalidcombo"][0] );
105
+	}
106 106
 
107
-    public function tearDown()
108
-    {
109
-        parent::tearDown();
110
-    }
107
+	public function tearDown()
108
+	{
109
+		parent::tearDown();
110
+	}
111 111
 
112 112
 }
113 113
 ?>
114 114
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
         geodir_user_signup();
17 17
         remove_filter('wp_redirect', '__return_false');
18 18
         $errors = (array) $errors;
19
-        $this->assertArrayHasKey( 'empty_password', $errors["errors"] );
20
-        $this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] );
19
+        $this->assertArrayHasKey('empty_password', $errors["errors"]);
20
+        $this->assertContains('The password field is empty', $errors["errors"]["empty_password"][0]);
21 21
     }
22 22
 
23 23
     public function testLoginIncorrectPassword()
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
         geodir_user_signup();
31 31
         remove_filter('wp_redirect', '__return_false');
32 32
         $errors = (array) $errors;
33
-        $this->assertArrayHasKey( 'incorrect_password', $errors["errors"] );
34
-        $this->assertContains( 'The password you entered for the username', $errors["errors"]["incorrect_password"][0] );
33
+        $this->assertArrayHasKey('incorrect_password', $errors["errors"]);
34
+        $this->assertContains('The password you entered for the username', $errors["errors"]["incorrect_password"][0]);
35 35
     }
36 36
 
37 37
     public function testLoginInvalidUsername()
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
         geodir_user_signup();
45 45
         remove_filter('wp_redirect', '__return_false');
46 46
         $errors = (array) $errors;
47
-        $this->assertArrayHasKey( 'invalid_username', $errors["errors"] );
48
-        $this->assertContains( 'Invalid username', $errors["errors"]["invalid_username"][0] );
47
+        $this->assertArrayHasKey('invalid_username', $errors["errors"]);
48
+        $this->assertContains('Invalid username', $errors["errors"]["invalid_username"][0]);
49 49
     }
50 50
 
51 51
 //    public function testLoginValid()
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
         geodir_user_signup();
71 71
         remove_filter('wp_redirect', '__return_false');
72 72
         $errors = (array) $errors;
73
-        $this->assertArrayHasKey( 'empty_username', $errors["errors"] );
74
-        $this->assertContains( 'Enter a username or e-mail address', $errors["errors"]["empty_username"][0] );
73
+        $this->assertArrayHasKey('empty_username', $errors["errors"]);
74
+        $this->assertContains('Enter a username or e-mail address', $errors["errors"]["empty_username"][0]);
75 75
     }
76 76
 
77 77
     public function testForgotPassInvalidEmail()
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
         geodir_user_signup();
86 86
         remove_filter('wp_redirect', '__return_false');
87 87
         $errors = (array) $errors;
88
-        $this->assertArrayHasKey( 'invalid_email', $errors["errors"] );
89
-        $this->assertContains( 'There is no user registered with that email address', $errors["errors"]["invalid_email"][0] );
88
+        $this->assertArrayHasKey('invalid_email', $errors["errors"]);
89
+        $this->assertContains('There is no user registered with that email address', $errors["errors"]["invalid_email"][0]);
90 90
     }
91 91
 
92 92
     public function testForgotPassInvalidUsername()
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
         geodir_user_signup();
101 101
         remove_filter('wp_redirect', '__return_false');
102 102
         $errors = (array) $errors;
103
-        $this->assertArrayHasKey( 'invalidcombo', $errors["errors"] );
104
-        $this->assertContains( 'Invalid username or e-mail', $errors["errors"]["invalidcombo"][0] );
103
+        $this->assertArrayHasKey('invalidcombo', $errors["errors"]);
104
+        $this->assertContains('Invalid username or e-mail', $errors["errors"]["invalidcombo"][0]);
105 105
     }
106 106
 
107 107
     public function tearDown()
Please login to merge, or discard this patch.
tests/test-Delete_Listing.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,40 +1,40 @@
 block discarded – undo
1 1
 <?php
2 2
 class DeleteListing extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-        wp_set_current_user(1);
8
-        deactivate_plugins('buddypress/bp-loader.php');
9
-        remove_filter( 'muplugins_loaded', '_tests_load_bp_registration_options' );
10
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+		wp_set_current_user(1);
8
+		deactivate_plugins('buddypress/bp-loader.php');
9
+		remove_filter( 'muplugins_loaded', '_tests_load_bp_registration_options' );
10
+	}
11 11
 
12
-    public function testDeleteListing()
13
-    {
14
-        $query_args = array(
15
-            'post_status' => 'publish',
16
-            'post_type' => 'gd_place',
17
-            'posts_per_page' => 1,
18
-            'author' => 1
19
-        );
12
+	public function testDeleteListing()
13
+	{
14
+		$query_args = array(
15
+			'post_status' => 'publish',
16
+			'post_type' => 'gd_place',
17
+			'posts_per_page' => 1,
18
+			'author' => 1
19
+		);
20 20
 
21
-        $all_posts = new WP_Query( $query_args );
22
-        $post_id = null;
23
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
24
-            $post_id = get_the_ID();
25
-        endwhile;
21
+		$all_posts = new WP_Query( $query_args );
22
+		$post_id = null;
23
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
24
+			$post_id = get_the_ID();
25
+		endwhile;
26 26
 
27
-        $this->assertTrue(is_int($post_id));
27
+		$this->assertTrue(is_int($post_id));
28 28
 
29
-        $lastid = wp_delete_post($post_id);
29
+		$lastid = wp_delete_post($post_id);
30 30
 
31
-        $this->assertTrue(is_int($lastid->ID));
31
+		$this->assertTrue(is_int($lastid->ID));
32 32
 
33
-    }
33
+	}
34 34
 
35
-    public function tearDown()
36
-    {
37
-        parent::tearDown();
38
-    }
35
+	public function tearDown()
36
+	{
37
+		parent::tearDown();
38
+	}
39 39
 }
40 40
 ?>
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
         parent::setUp();
7 7
         wp_set_current_user(1);
8 8
         deactivate_plugins('buddypress/bp-loader.php');
9
-        remove_filter( 'muplugins_loaded', '_tests_load_bp_registration_options' );
9
+        remove_filter('muplugins_loaded', '_tests_load_bp_registration_options');
10 10
     }
11 11
 
12 12
     public function testDeleteListing()
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
             'author' => 1
19 19
         );
20 20
 
21
-        $all_posts = new WP_Query( $query_args );
21
+        $all_posts = new WP_Query($query_args);
22 22
         $post_id = null;
23
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
23
+        while ($all_posts->have_posts()) : $all_posts->the_post();
24 24
             $post_id = get_the_ID();
25 25
         endwhile;
26 26
 
Please login to merge, or discard this patch.
tests/test-Edit_Listing.php 2 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1,63 +1,63 @@
 block discarded – undo
1 1
 <?php
2 2
 class EditListing extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-        wp_set_current_user(1);
8
-    }
9
-
10
-    public function testEditListing()
11
-    {
12
-        $query_args = array(
13
-            'post_status' => 'publish',
14
-            'post_type' => 'gd_place',
15
-            'posts_per_page' => 1,
16
-        );
17
-
18
-        $all_posts = new WP_Query( $query_args );
19
-        $post_id = null;
20
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
21
-            $post_id = get_the_ID();
22
-        endwhile;
23
-
24
-        $this->assertTrue(is_int($post_id));
25
-
26
-        $args = array(
27
-            'pid' => $post_id,
28
-            'listing_type' => 'gd_place',
29
-            'post_title' => 'Test Listing Title Modified',
30
-            'post_desc' => 'Test Desc',
31
-            'post_tags' => 'test1,test2',
32
-            'post_address' => 'New York City Hall',
33
-            'post_zip' => '10007',
34
-            'post_latitude' => '40.7127837',
35
-            'post_longitude' => '-74.00594130000002',
36
-            'post_mapview' => 'ROADMAP',
37
-            'post_mapzoom' => '10',
38
-            'geodir_timing' => '10.00 am to 6 pm every day',
39
-            'geodir_contact' => '1234567890',
40
-            'geodir_email' => '[email protected]',
41
-            'geodir_website' => 'http://test.com',
42
-            'geodir_twitter' => 'http://twitter.com/test',
43
-            'geodir_facebook' => 'http://facebook.com/test',
44
-            'geodir_special_offers' => 'Test offer'
45
-        );
46
-        $saved_post_id = geodir_save_listing($args, true);
47
-
48
-        $this->assertTrue(is_int($saved_post_id));
49
-
50
-        $title = get_the_title($post_id);
51
-
52
-        $this->assertEquals('Test Listing Title Modified', $title);
53
-
54
-
55
-    }
56
-
57
-
58
-    public function tearDown()
59
-    {
60
-        parent::tearDown();
61
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+		wp_set_current_user(1);
8
+	}
9
+
10
+	public function testEditListing()
11
+	{
12
+		$query_args = array(
13
+			'post_status' => 'publish',
14
+			'post_type' => 'gd_place',
15
+			'posts_per_page' => 1,
16
+		);
17
+
18
+		$all_posts = new WP_Query( $query_args );
19
+		$post_id = null;
20
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
21
+			$post_id = get_the_ID();
22
+		endwhile;
23
+
24
+		$this->assertTrue(is_int($post_id));
25
+
26
+		$args = array(
27
+			'pid' => $post_id,
28
+			'listing_type' => 'gd_place',
29
+			'post_title' => 'Test Listing Title Modified',
30
+			'post_desc' => 'Test Desc',
31
+			'post_tags' => 'test1,test2',
32
+			'post_address' => 'New York City Hall',
33
+			'post_zip' => '10007',
34
+			'post_latitude' => '40.7127837',
35
+			'post_longitude' => '-74.00594130000002',
36
+			'post_mapview' => 'ROADMAP',
37
+			'post_mapzoom' => '10',
38
+			'geodir_timing' => '10.00 am to 6 pm every day',
39
+			'geodir_contact' => '1234567890',
40
+			'geodir_email' => '[email protected]',
41
+			'geodir_website' => 'http://test.com',
42
+			'geodir_twitter' => 'http://twitter.com/test',
43
+			'geodir_facebook' => 'http://facebook.com/test',
44
+			'geodir_special_offers' => 'Test offer'
45
+		);
46
+		$saved_post_id = geodir_save_listing($args, true);
47
+
48
+		$this->assertTrue(is_int($saved_post_id));
49
+
50
+		$title = get_the_title($post_id);
51
+
52
+		$this->assertEquals('Test Listing Title Modified', $title);
53
+
54
+
55
+	}
56
+
57
+
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.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@
 block discarded – undo
15 15
             'posts_per_page' => 1,
16 16
         );
17 17
 
18
-        $all_posts = new WP_Query( $query_args );
18
+        $all_posts = new WP_Query($query_args);
19 19
         $post_id = null;
20
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
20
+        while ($all_posts->have_posts()) : $all_posts->the_post();
21 21
             $post_id = get_the_ID();
22 22
         endwhile;
23 23
 
Please login to merge, or discard this patch.
tests/test-Check_Shortcodes.php 2 patches
Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -1,150 +1,150 @@
 block discarded – undo
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 testCptCategoriesShortcode()
18
-    {
19
-        $output = do_shortcode('[gd_cpt_categories show_count=1]');
20
-        $this->assertContains( 'gd-cptcats-widget', $output );
21
-    }
22
-
23
-    public function testListingMapShortcode()
24
-    {
25
-        $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]');
26
-        $this->assertContains( 'geodir-map-listing-page', $output );
27
-    }
28
-
29
-    public function testListingSliderShortcode()
30
-    {
31
-        $output = do_shortcode('[gd_listing_slider post_number=5 category=3 slideshow=true show_featured_only=true]');
32
-        $this->assertContains( 'geodir_widget_carousel', $output );
33
-    }
34
-
35
-    public function testLoginBoxShortcode()
36
-    {
37
-        $output = do_shortcode('[gd_login_box]');
38
-        $this->assertContains( 'geodir-loginbox-list', $output );
39
-    }
40
-
41
-    public function texstPopPostCatShortcode()
42
-    {
43
-        global $geodir_post_type;
44
-        $geodir_post_type = 'gd_place';
45
-        $output = do_shortcode('[gd_popular_post_category category_limit=30]');
46
-        $this->assertContains( 'geodir-popular-cat-list', $output );
47
-    }
48
-
49
-    public function testPopPostViewShortcode()
50
-    {
51
-        $output = do_shortcode('[gd_popular_post_view category=3 layout=5 add_location_filter=true character_count=0 show_featured_only=true]');
52
-        $this->assertContains( 'geodir_category_list_view', $output );
53
-    }
54
-
55
-    public function testRecentReviewsShortcode()
56
-    {
57
-        $query_args = array(
58
-            'post_status' => 'publish',
59
-            'post_type' => 'gd_place',
60
-            'posts_per_page' => 1,
61
-        );
62
-
63
-        $all_posts = new WP_Query( $query_args );
64
-        $post_id = null;
65
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
66
-            $post_id = get_the_ID();
67
-        endwhile;
68
-
69
-        $this->assertTrue(is_int($post_id));
70
-
71
-        $time = current_time('mysql');
72
-
73
-        $data = array(
74
-            'comment_post_ID' => $post_id,
75
-            'comment_author' => 'admin',
76
-            'comment_author_email' => '[email protected]',
77
-            'comment_author_url' => 'http://wpgeodirectory.com',
78
-            'comment_content' => 'content here testtcc',
79
-            'comment_type' => '',
80
-            'comment_parent' => 0,
81
-            'user_id' => 1,
82
-            'comment_author_IP' => '127.0.0.1',
83
-            '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)',
84
-            'comment_date' => $time,
85
-            'comment_approved' => 1,
86
-        );
87
-
88
-        $comment_id = wp_insert_comment($data);
89
-
90
-        $_REQUEST['geodir_overallrating'] = 5.0;
91
-        geodir_save_rating($comment_id);
92
-
93
-        $output = do_shortcode('[gd_recent_reviews count=5]');
94
-        $this->assertContains( 'geodir_sc_recent_reviews', $output );
95
-    }
96
-
97
-    public function texstRelatedListingsShortcode()
98
-    {
99
-        $query_args = array(
100
-            'post_status' => 'publish',
101
-            'post_type' => 'gd_place',
102
-            'posts_per_page' => 1,
103
-        );
104
-
105
-        $all_posts = new WP_Query( $query_args );
106
-        $post_id = null;
107
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
108
-            $post_id = get_the_ID();
109
-            global $post;
110
-            $post =  geodir_get_post_info($post_id);
111
-            setup_postdata($post);
112
-            $output = do_shortcode('[gd_related_listings relate_to=category layout=3 add_location_filter=0 list_sort=featured character_count=0]');
113
-            $this->assertContains( 'geodir_location_listing', $output );
114
-        endwhile;
115
-
116
-        $this->assertTrue(is_int($post_id));
117
-
118
-    }
119
-
120
-    public function texstAdvSearchShortcode()
121
-    {
122
-        $output = do_shortcode('[gd_advanced_search]');
123
-        $this->assertContains( 'geodir-map-home-page', $output );
124
-    }
125
-
126
-    public function texstListingsShortcode()
127
-    {
128
-        $output = do_shortcode('[gd_listings post_type="gd_place" category="1,3" post_number="10" list_sort="high_review"]');
129
-        $this->assertContains( 'geodir-sc-gd-listings', $output );
130
-    }
131
-
132
-    public function texstBestOfWidgetShortcode()
133
-    {
134
-        $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]');
135
-        $this->assertContains( 'geodir_bestof_widget', $output );
136
-    }
137
-
138
-    public function testAddListingShortcode()
139
-    {
140
-        $_REQUEST['listing_type'] = 'gd_place';
141
-        $output = do_shortcode('[gd_add_listing listing_type=gd_place login_msg="Please register and login to submit listings" show_login=true]');
142
-        $this->assertContains( 'geodir-add-listing-submit', $output );
143
-    }
144
-
145
-    public function tearDown()
146
-    {
147
-        parent::tearDown();
148
-    }
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 testCptCategoriesShortcode()
18
+	{
19
+		$output = do_shortcode('[gd_cpt_categories show_count=1]');
20
+		$this->assertContains( 'gd-cptcats-widget', $output );
21
+	}
22
+
23
+	public function testListingMapShortcode()
24
+	{
25
+		$output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]');
26
+		$this->assertContains( 'geodir-map-listing-page', $output );
27
+	}
28
+
29
+	public function testListingSliderShortcode()
30
+	{
31
+		$output = do_shortcode('[gd_listing_slider post_number=5 category=3 slideshow=true show_featured_only=true]');
32
+		$this->assertContains( 'geodir_widget_carousel', $output );
33
+	}
34
+
35
+	public function testLoginBoxShortcode()
36
+	{
37
+		$output = do_shortcode('[gd_login_box]');
38
+		$this->assertContains( 'geodir-loginbox-list', $output );
39
+	}
40
+
41
+	public function texstPopPostCatShortcode()
42
+	{
43
+		global $geodir_post_type;
44
+		$geodir_post_type = 'gd_place';
45
+		$output = do_shortcode('[gd_popular_post_category category_limit=30]');
46
+		$this->assertContains( 'geodir-popular-cat-list', $output );
47
+	}
48
+
49
+	public function testPopPostViewShortcode()
50
+	{
51
+		$output = do_shortcode('[gd_popular_post_view category=3 layout=5 add_location_filter=true character_count=0 show_featured_only=true]');
52
+		$this->assertContains( 'geodir_category_list_view', $output );
53
+	}
54
+
55
+	public function testRecentReviewsShortcode()
56
+	{
57
+		$query_args = array(
58
+			'post_status' => 'publish',
59
+			'post_type' => 'gd_place',
60
+			'posts_per_page' => 1,
61
+		);
62
+
63
+		$all_posts = new WP_Query( $query_args );
64
+		$post_id = null;
65
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
66
+			$post_id = get_the_ID();
67
+		endwhile;
68
+
69
+		$this->assertTrue(is_int($post_id));
70
+
71
+		$time = current_time('mysql');
72
+
73
+		$data = array(
74
+			'comment_post_ID' => $post_id,
75
+			'comment_author' => 'admin',
76
+			'comment_author_email' => '[email protected]',
77
+			'comment_author_url' => 'http://wpgeodirectory.com',
78
+			'comment_content' => 'content here testtcc',
79
+			'comment_type' => '',
80
+			'comment_parent' => 0,
81
+			'user_id' => 1,
82
+			'comment_author_IP' => '127.0.0.1',
83
+			'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)',
84
+			'comment_date' => $time,
85
+			'comment_approved' => 1,
86
+		);
87
+
88
+		$comment_id = wp_insert_comment($data);
89
+
90
+		$_REQUEST['geodir_overallrating'] = 5.0;
91
+		geodir_save_rating($comment_id);
92
+
93
+		$output = do_shortcode('[gd_recent_reviews count=5]');
94
+		$this->assertContains( 'geodir_sc_recent_reviews', $output );
95
+	}
96
+
97
+	public function texstRelatedListingsShortcode()
98
+	{
99
+		$query_args = array(
100
+			'post_status' => 'publish',
101
+			'post_type' => 'gd_place',
102
+			'posts_per_page' => 1,
103
+		);
104
+
105
+		$all_posts = new WP_Query( $query_args );
106
+		$post_id = null;
107
+		while ( $all_posts->have_posts() ) : $all_posts->the_post();
108
+			$post_id = get_the_ID();
109
+			global $post;
110
+			$post =  geodir_get_post_info($post_id);
111
+			setup_postdata($post);
112
+			$output = do_shortcode('[gd_related_listings relate_to=category layout=3 add_location_filter=0 list_sort=featured character_count=0]');
113
+			$this->assertContains( 'geodir_location_listing', $output );
114
+		endwhile;
115
+
116
+		$this->assertTrue(is_int($post_id));
117
+
118
+	}
119
+
120
+	public function texstAdvSearchShortcode()
121
+	{
122
+		$output = do_shortcode('[gd_advanced_search]');
123
+		$this->assertContains( 'geodir-map-home-page', $output );
124
+	}
125
+
126
+	public function texstListingsShortcode()
127
+	{
128
+		$output = do_shortcode('[gd_listings post_type="gd_place" category="1,3" post_number="10" list_sort="high_review"]');
129
+		$this->assertContains( 'geodir-sc-gd-listings', $output );
130
+	}
131
+
132
+	public function texstBestOfWidgetShortcode()
133
+	{
134
+		$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]');
135
+		$this->assertContains( 'geodir_bestof_widget', $output );
136
+	}
137
+
138
+	public function testAddListingShortcode()
139
+	{
140
+		$_REQUEST['listing_type'] = 'gd_place';
141
+		$output = do_shortcode('[gd_add_listing listing_type=gd_place login_msg="Please register and login to submit listings" show_login=true]');
142
+		$this->assertContains( 'geodir-add-listing-submit', $output );
143
+	}
144
+
145
+	public function tearDown()
146
+	{
147
+		parent::tearDown();
148
+	}
149 149
 }
150 150
 ?>
151 151
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -11,31 +11,31 @@  discard block
 block discarded – undo
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 testCptCategoriesShortcode()
18 18
     {
19 19
         $output = do_shortcode('[gd_cpt_categories show_count=1]');
20
-        $this->assertContains( 'gd-cptcats-widget', $output );
20
+        $this->assertContains('gd-cptcats-widget', $output);
21 21
     }
22 22
 
23 23
     public function testListingMapShortcode()
24 24
     {
25 25
         $output = do_shortcode('[gd_listing_map width=100% height=300 scrollwheel=false sticky=true]');
26
-        $this->assertContains( 'geodir-map-listing-page', $output );
26
+        $this->assertContains('geodir-map-listing-page', $output);
27 27
     }
28 28
 
29 29
     public function testListingSliderShortcode()
30 30
     {
31 31
         $output = do_shortcode('[gd_listing_slider post_number=5 category=3 slideshow=true show_featured_only=true]');
32
-        $this->assertContains( 'geodir_widget_carousel', $output );
32
+        $this->assertContains('geodir_widget_carousel', $output);
33 33
     }
34 34
 
35 35
     public function testLoginBoxShortcode()
36 36
     {
37 37
         $output = do_shortcode('[gd_login_box]');
38
-        $this->assertContains( 'geodir-loginbox-list', $output );
38
+        $this->assertContains('geodir-loginbox-list', $output);
39 39
     }
40 40
 
41 41
     public function texstPopPostCatShortcode()
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
         global $geodir_post_type;
44 44
         $geodir_post_type = 'gd_place';
45 45
         $output = do_shortcode('[gd_popular_post_category category_limit=30]');
46
-        $this->assertContains( 'geodir-popular-cat-list', $output );
46
+        $this->assertContains('geodir-popular-cat-list', $output);
47 47
     }
48 48
 
49 49
     public function testPopPostViewShortcode()
50 50
     {
51 51
         $output = do_shortcode('[gd_popular_post_view category=3 layout=5 add_location_filter=true character_count=0 show_featured_only=true]');
52
-        $this->assertContains( 'geodir_category_list_view', $output );
52
+        $this->assertContains('geodir_category_list_view', $output);
53 53
     }
54 54
 
55 55
     public function testRecentReviewsShortcode()
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
             'posts_per_page' => 1,
61 61
         );
62 62
 
63
-        $all_posts = new WP_Query( $query_args );
63
+        $all_posts = new WP_Query($query_args);
64 64
         $post_id = null;
65
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
65
+        while ($all_posts->have_posts()) : $all_posts->the_post();
66 66
             $post_id = get_the_ID();
67 67
         endwhile;
68 68
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         geodir_save_rating($comment_id);
92 92
 
93 93
         $output = do_shortcode('[gd_recent_reviews count=5]');
94
-        $this->assertContains( 'geodir_sc_recent_reviews', $output );
94
+        $this->assertContains('geodir_sc_recent_reviews', $output);
95 95
     }
96 96
 
97 97
     public function texstRelatedListingsShortcode()
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
             'posts_per_page' => 1,
103 103
         );
104 104
 
105
-        $all_posts = new WP_Query( $query_args );
105
+        $all_posts = new WP_Query($query_args);
106 106
         $post_id = null;
107
-        while ( $all_posts->have_posts() ) : $all_posts->the_post();
107
+        while ($all_posts->have_posts()) : $all_posts->the_post();
108 108
             $post_id = get_the_ID();
109 109
             global $post;
110
-            $post =  geodir_get_post_info($post_id);
110
+            $post = geodir_get_post_info($post_id);
111 111
             setup_postdata($post);
112 112
             $output = do_shortcode('[gd_related_listings relate_to=category layout=3 add_location_filter=0 list_sort=featured character_count=0]');
113
-            $this->assertContains( 'geodir_location_listing', $output );
113
+            $this->assertContains('geodir_location_listing', $output);
114 114
         endwhile;
115 115
 
116 116
         $this->assertTrue(is_int($post_id));
@@ -120,26 +120,26 @@  discard block
 block discarded – undo
120 120
     public function texstAdvSearchShortcode()
121 121
     {
122 122
         $output = do_shortcode('[gd_advanced_search]');
123
-        $this->assertContains( 'geodir-map-home-page', $output );
123
+        $this->assertContains('geodir-map-home-page', $output);
124 124
     }
125 125
 
126 126
     public function texstListingsShortcode()
127 127
     {
128 128
         $output = do_shortcode('[gd_listings post_type="gd_place" category="1,3" post_number="10" list_sort="high_review"]');
129
-        $this->assertContains( 'geodir-sc-gd-listings', $output );
129
+        $this->assertContains('geodir-sc-gd-listings', $output);
130 130
     }
131 131
 
132 132
     public function texstBestOfWidgetShortcode()
133 133
     {
134 134
         $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]');
135
-        $this->assertContains( 'geodir_bestof_widget', $output );
135
+        $this->assertContains('geodir_bestof_widget', $output);
136 136
     }
137 137
 
138 138
     public function testAddListingShortcode()
139 139
     {
140 140
         $_REQUEST['listing_type'] = 'gd_place';
141 141
         $output = do_shortcode('[gd_add_listing listing_type=gd_place login_msg="Please register and login to submit listings" show_login=true]');
142
-        $this->assertContains( 'geodir-add-listing-submit', $output );
142
+        $this->assertContains('geodir-add-listing-submit', $output);
143 143
     }
144 144
 
145 145
     public function tearDown()
Please login to merge, or discard this patch.
tests/test-Register.php 2 patches
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -1,89 +1,89 @@
 block discarded – undo
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&#8217;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&#8217;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 tearDown()
84
-    {
85
-        parent::tearDown();
86
-    }
83
+	public function tearDown()
84
+	{
85
+		parent::tearDown();
86
+	}
87 87
 
88 88
 }
89 89
 ?>
90 90
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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&#8217;t correct', $errors["errors"]["invalid_email"][0] );
36
+        $this->assertArrayHasKey('invalid_email', $errors["errors"]);
37
+        $this->assertContains('The email address isn&#8217;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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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() {
Please login to merge, or discard this patch.