@@ -13,35 +13,35 @@ |
||
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() { |
@@ -1,38 +1,38 @@ |
||
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 |
@@ -15,9 +15,9 @@ |
||
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 |
@@ -1,39 +1,39 @@ |
||
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 |
@@ -1,57 +1,57 @@ |
||
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 |
@@ -15,8 +15,8 @@ discard block |
||
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 |
||
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 |
||
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() |
@@ -1,52 +1,52 @@ discard block |
||
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 |
||
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 |
@@ -16,8 +16,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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() |
@@ -1,40 +1,40 @@ |
||
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 |
@@ -6,7 +6,7 @@ discard block |
||
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 |
||
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 |
@@ -1,63 +1,63 @@ |
||
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 |
@@ -15,9 +15,9 @@ |
||
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 |
@@ -1,89 +1,89 @@ |
||
1 | 1 | <?php |
2 | 2 | class Register extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - wp_set_current_user(0); |
|
8 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + wp_set_current_user(0); |
|
8 | + } |
|
9 | 9 | |
10 | - public function test_register_empty_username() { |
|
11 | - $errors = geodir_register_new_user( |
|
12 | - '', |
|
13 | - '[email protected]' |
|
14 | - ); |
|
15 | - $errors = (array) $errors; |
|
16 | - $this->assertArrayHasKey( 'empty_username', $errors["errors"] ); |
|
17 | - $this->assertContains( 'Please enter a username', $errors["errors"]["empty_username"][0] ); |
|
18 | - } |
|
10 | + public function test_register_empty_username() { |
|
11 | + $errors = geodir_register_new_user( |
|
12 | + '', |
|
13 | + '[email protected]' |
|
14 | + ); |
|
15 | + $errors = (array) $errors; |
|
16 | + $this->assertArrayHasKey( 'empty_username', $errors["errors"] ); |
|
17 | + $this->assertContains( 'Please enter a username', $errors["errors"]["empty_username"][0] ); |
|
18 | + } |
|
19 | 19 | |
20 | - public function test_register_invalid_username() { |
|
21 | - $errors = geodir_register_new_user( |
|
22 | - '@#$%^', |
|
23 | - '[email protected]' |
|
24 | - ); |
|
25 | - $errors = (array) $errors; |
|
26 | - $this->assertArrayHasKey( 'invalid_username', $errors["errors"] ); |
|
27 | - $this->assertContains( 'This username is invalid', $errors["errors"]["invalid_username"][0] ); |
|
28 | - } |
|
20 | + public function test_register_invalid_username() { |
|
21 | + $errors = geodir_register_new_user( |
|
22 | + '@#$%^', |
|
23 | + '[email protected]' |
|
24 | + ); |
|
25 | + $errors = (array) $errors; |
|
26 | + $this->assertArrayHasKey( 'invalid_username', $errors["errors"] ); |
|
27 | + $this->assertContains( 'This username is invalid', $errors["errors"]["invalid_username"][0] ); |
|
28 | + } |
|
29 | 29 | |
30 | - public function test_register_invalid_email() { |
|
31 | - $errors = geodir_register_new_user( |
|
32 | - 'hello', |
|
33 | - 'hello@@hi.com' |
|
34 | - ); |
|
35 | - $errors = (array) $errors; |
|
36 | - $this->assertArrayHasKey( 'invalid_email', $errors["errors"] ); |
|
37 | - $this->assertContains( 'The email address isn’t correct', $errors["errors"]["invalid_email"][0] ); |
|
38 | - } |
|
30 | + public function test_register_invalid_email() { |
|
31 | + $errors = geodir_register_new_user( |
|
32 | + 'hello', |
|
33 | + 'hello@@hi.com' |
|
34 | + ); |
|
35 | + $errors = (array) $errors; |
|
36 | + $this->assertArrayHasKey( 'invalid_email', $errors["errors"] ); |
|
37 | + $this->assertContains( 'The email address isn’t correct', $errors["errors"]["invalid_email"][0] ); |
|
38 | + } |
|
39 | 39 | |
40 | - public function test_register_empty_email() { |
|
41 | - $errors = geodir_register_new_user( |
|
42 | - 'hello', |
|
43 | - '' |
|
44 | - ); |
|
45 | - $errors = (array) $errors; |
|
46 | - $this->assertArrayHasKey( 'empty_email', $errors["errors"] ); |
|
47 | - $this->assertContains( 'Please type your e-mail address', $errors["errors"]["empty_email"][0] ); |
|
48 | - } |
|
40 | + public function test_register_empty_email() { |
|
41 | + $errors = geodir_register_new_user( |
|
42 | + 'hello', |
|
43 | + '' |
|
44 | + ); |
|
45 | + $errors = (array) $errors; |
|
46 | + $this->assertArrayHasKey( 'empty_email', $errors["errors"] ); |
|
47 | + $this->assertContains( 'Please type your e-mail address', $errors["errors"]["empty_email"][0] ); |
|
48 | + } |
|
49 | 49 | |
50 | - public function test_register_invalid_password() { |
|
51 | - update_option('geodir_allow_cpass', 1); |
|
52 | - $_REQUEST['user_pass'] = '12345'; |
|
53 | - $_REQUEST['user_pass2'] = '1234'; |
|
54 | - $_POST['user_fname'] = 'Test User'; |
|
55 | - $errors = geodir_register_new_user( |
|
56 | - 'hello', |
|
57 | - '[email protected]' |
|
58 | - ); |
|
59 | - $errors = (array) $errors; |
|
60 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
61 | - $this->assertContains( 'Passwords do not match', $errors["errors"]["pass_match"][0] ); |
|
50 | + public function test_register_invalid_password() { |
|
51 | + update_option('geodir_allow_cpass', 1); |
|
52 | + $_REQUEST['user_pass'] = '12345'; |
|
53 | + $_REQUEST['user_pass2'] = '1234'; |
|
54 | + $_POST['user_fname'] = 'Test User'; |
|
55 | + $errors = geodir_register_new_user( |
|
56 | + 'hello', |
|
57 | + '[email protected]' |
|
58 | + ); |
|
59 | + $errors = (array) $errors; |
|
60 | + $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
61 | + $this->assertContains( 'Passwords do not match', $errors["errors"]["pass_match"][0] ); |
|
62 | 62 | |
63 | - $_REQUEST['user_pass'] = '12345'; |
|
64 | - $_REQUEST['user_pass2'] = '12345'; |
|
65 | - $errors = geodir_register_new_user( |
|
66 | - 'hello', |
|
67 | - '[email protected]' |
|
68 | - ); |
|
69 | - $errors = (array) $errors; |
|
70 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
71 | - $this->assertContains( 'Password must be 7 characters or more', $errors["errors"]["pass_match"][0] ); |
|
72 | - } |
|
63 | + $_REQUEST['user_pass'] = '12345'; |
|
64 | + $_REQUEST['user_pass2'] = '12345'; |
|
65 | + $errors = geodir_register_new_user( |
|
66 | + 'hello', |
|
67 | + '[email protected]' |
|
68 | + ); |
|
69 | + $errors = (array) $errors; |
|
70 | + $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
71 | + $this->assertContains( 'Password must be 7 characters or more', $errors["errors"]["pass_match"][0] ); |
|
72 | + } |
|
73 | 73 | |
74 | - public function test_register_success() { |
|
75 | - $_POST['user_fname'] = 'Test User'; |
|
76 | - $data = geodir_register_new_user( |
|
77 | - 'hello', |
|
78 | - '[email protected]' |
|
79 | - ); |
|
80 | - $this->assertInternalType("int", $data[0]); |
|
81 | - } |
|
74 | + public function test_register_success() { |
|
75 | + $_POST['user_fname'] = 'Test User'; |
|
76 | + $data = geodir_register_new_user( |
|
77 | + 'hello', |
|
78 | + '[email protected]' |
|
79 | + ); |
|
80 | + $this->assertInternalType("int", $data[0]); |
|
81 | + } |
|
82 | 82 | |
83 | - public function 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 |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | '[email protected]' |
14 | 14 | ); |
15 | 15 | $errors = (array) $errors; |
16 | - $this->assertArrayHasKey( 'empty_username', $errors["errors"] ); |
|
17 | - $this->assertContains( 'Please enter a username', $errors["errors"]["empty_username"][0] ); |
|
16 | + $this->assertArrayHasKey('empty_username', $errors["errors"]); |
|
17 | + $this->assertContains('Please enter a username', $errors["errors"]["empty_username"][0]); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function test_register_invalid_username() { |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | '[email protected]' |
24 | 24 | ); |
25 | 25 | $errors = (array) $errors; |
26 | - $this->assertArrayHasKey( 'invalid_username', $errors["errors"] ); |
|
27 | - $this->assertContains( 'This username is invalid', $errors["errors"]["invalid_username"][0] ); |
|
26 | + $this->assertArrayHasKey('invalid_username', $errors["errors"]); |
|
27 | + $this->assertContains('This username is invalid', $errors["errors"]["invalid_username"][0]); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function test_register_invalid_email() { |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | 'hello@@hi.com' |
34 | 34 | ); |
35 | 35 | $errors = (array) $errors; |
36 | - $this->assertArrayHasKey( 'invalid_email', $errors["errors"] ); |
|
37 | - $this->assertContains( 'The email address isn’t correct', $errors["errors"]["invalid_email"][0] ); |
|
36 | + $this->assertArrayHasKey('invalid_email', $errors["errors"]); |
|
37 | + $this->assertContains('The email address isn’t correct', $errors["errors"]["invalid_email"][0]); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public function test_register_empty_email() { |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | '' |
44 | 44 | ); |
45 | 45 | $errors = (array) $errors; |
46 | - $this->assertArrayHasKey( 'empty_email', $errors["errors"] ); |
|
47 | - $this->assertContains( 'Please type your e-mail address', $errors["errors"]["empty_email"][0] ); |
|
46 | + $this->assertArrayHasKey('empty_email', $errors["errors"]); |
|
47 | + $this->assertContains('Please type your e-mail address', $errors["errors"]["empty_email"][0]); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function test_register_invalid_password() { |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | '[email protected]' |
58 | 58 | ); |
59 | 59 | $errors = (array) $errors; |
60 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
61 | - $this->assertContains( 'Passwords do not match', $errors["errors"]["pass_match"][0] ); |
|
60 | + $this->assertArrayHasKey('pass_match', $errors["errors"]); |
|
61 | + $this->assertContains('Passwords do not match', $errors["errors"]["pass_match"][0]); |
|
62 | 62 | |
63 | 63 | $_REQUEST['user_pass'] = '12345'; |
64 | 64 | $_REQUEST['user_pass2'] = '12345'; |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | '[email protected]' |
68 | 68 | ); |
69 | 69 | $errors = (array) $errors; |
70 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
71 | - $this->assertContains( 'Password must be 7 characters or more', $errors["errors"]["pass_match"][0] ); |
|
70 | + $this->assertArrayHasKey('pass_match', $errors["errors"]); |
|
71 | + $this->assertContains('Password must be 7 characters or more', $errors["errors"]["pass_match"][0]); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function test_register_success() { |
@@ -1,76 +1,76 @@ |
||
1 | 1 | <?php |
2 | 2 | class AddCustomFields 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 testAddCustomFields() |
|
10 | - { |
|
11 | - $field = array( |
|
12 | - 'listing_type' => 'gd_place', |
|
13 | - 'data_type' => '', |
|
14 | - 'field_type' => 'select', |
|
15 | - 'admin_title' => __( 'Place Type', 'test' ), |
|
16 | - 'admin_desc' => __( 'Select the place type.', 'test' ), |
|
17 | - 'site_title' => __( 'Place Type', 'test' ), |
|
18 | - 'htmlvar_name' => 'test_place_type', |
|
19 | - 'default_value' => '', |
|
20 | - 'option_values' => 'Hotel,Bar,Restaurant,Pub', |
|
21 | - 'is_default' => '1', |
|
22 | - 'is_admin' => '1', |
|
23 | - 'clabels' => __( 'Place Type', 'test' ) |
|
24 | - ); |
|
9 | + public function testAddCustomFields() |
|
10 | + { |
|
11 | + $field = array( |
|
12 | + 'listing_type' => 'gd_place', |
|
13 | + 'data_type' => '', |
|
14 | + 'field_type' => 'select', |
|
15 | + 'admin_title' => __( 'Place Type', 'test' ), |
|
16 | + 'admin_desc' => __( 'Select the place type.', 'test' ), |
|
17 | + 'site_title' => __( 'Place Type', 'test' ), |
|
18 | + 'htmlvar_name' => 'test_place_type', |
|
19 | + 'default_value' => '', |
|
20 | + 'option_values' => 'Hotel,Bar,Restaurant,Pub', |
|
21 | + 'is_default' => '1', |
|
22 | + 'is_admin' => '1', |
|
23 | + 'clabels' => __( 'Place Type', 'test' ) |
|
24 | + ); |
|
25 | 25 | |
26 | - $lastid = geodir_custom_field_save( $field ); |
|
26 | + $lastid = geodir_custom_field_save( $field ); |
|
27 | 27 | |
28 | - $this->assertTrue(is_int($lastid)); |
|
28 | + $this->assertTrue(is_int($lastid)); |
|
29 | 29 | |
30 | 30 | |
31 | - $field2 = array( |
|
32 | - 'listing_type' => 'gd_place', |
|
33 | - 'data_type' => 'VARCHAR', |
|
34 | - 'field_type' => 'url', |
|
35 | - 'admin_title' => __( 'Website Link', 'test' ), |
|
36 | - 'admin_desc' => __( 'Enter the website link.', 'test' ), |
|
37 | - 'site_title' => __( 'Website Link', 'test' ), |
|
38 | - 'htmlvar_name' => 'test_ws_link', |
|
39 | - 'default_value' => '', |
|
40 | - 'option_values' => '', |
|
41 | - 'is_default' => '1', |
|
42 | - 'is_admin' => '1', |
|
43 | - 'clabels' => __( 'Website Link', 'test' ) |
|
44 | - ); |
|
31 | + $field2 = array( |
|
32 | + 'listing_type' => 'gd_place', |
|
33 | + 'data_type' => 'VARCHAR', |
|
34 | + 'field_type' => 'url', |
|
35 | + 'admin_title' => __( 'Website Link', 'test' ), |
|
36 | + 'admin_desc' => __( 'Enter the website link.', 'test' ), |
|
37 | + 'site_title' => __( 'Website Link', 'test' ), |
|
38 | + 'htmlvar_name' => 'test_ws_link', |
|
39 | + 'default_value' => '', |
|
40 | + 'option_values' => '', |
|
41 | + 'is_default' => '1', |
|
42 | + 'is_admin' => '1', |
|
43 | + 'clabels' => __( 'Website Link', 'test' ) |
|
44 | + ); |
|
45 | 45 | |
46 | - $lastid2 = geodir_custom_field_save( $field2 ); |
|
46 | + $lastid2 = geodir_custom_field_save( $field2 ); |
|
47 | 47 | |
48 | - $this->assertTrue(is_int($lastid2)); |
|
48 | + $this->assertTrue(is_int($lastid2)); |
|
49 | 49 | |
50 | - //test error |
|
51 | - $field3 = array( |
|
52 | - 'listing_type' => 'gd_place', |
|
53 | - 'data_type' => '', |
|
54 | - 'field_type' => 'select', |
|
55 | - 'admin_title' => __( 'Place Type', 'test' ), |
|
56 | - 'admin_desc' => __( 'Select the place type.', 'test' ), |
|
57 | - 'site_title' => __( 'Place Type', 'test' ), |
|
58 | - 'htmlvar_name' => 'test_place_type', |
|
59 | - 'default_value' => '', |
|
60 | - 'option_values' => 'Hotel,Bar,Restaurant,Pub', |
|
61 | - 'is_default' => '1', |
|
62 | - 'is_admin' => '1', |
|
63 | - 'clabels' => __( 'Place Type', 'test' ) |
|
64 | - ); |
|
50 | + //test error |
|
51 | + $field3 = array( |
|
52 | + 'listing_type' => 'gd_place', |
|
53 | + 'data_type' => '', |
|
54 | + 'field_type' => 'select', |
|
55 | + 'admin_title' => __( 'Place Type', 'test' ), |
|
56 | + 'admin_desc' => __( 'Select the place type.', 'test' ), |
|
57 | + 'site_title' => __( 'Place Type', 'test' ), |
|
58 | + 'htmlvar_name' => 'test_place_type', |
|
59 | + 'default_value' => '', |
|
60 | + 'option_values' => 'Hotel,Bar,Restaurant,Pub', |
|
61 | + 'is_default' => '1', |
|
62 | + 'is_admin' => '1', |
|
63 | + 'clabels' => __( 'Place Type', 'test' ) |
|
64 | + ); |
|
65 | 65 | |
66 | - $error = geodir_custom_field_save( $field3 ); |
|
66 | + $error = geodir_custom_field_save( $field3 ); |
|
67 | 67 | |
68 | - $this->assertContains( 'HTML Variable Name should be a unique name', $error ); |
|
69 | - } |
|
68 | + $this->assertContains( 'HTML Variable Name should be a unique name', $error ); |
|
69 | + } |
|
70 | 70 | |
71 | - public function tearDown() |
|
72 | - { |
|
73 | - parent::tearDown(); |
|
74 | - } |
|
71 | + public function tearDown() |
|
72 | + { |
|
73 | + parent::tearDown(); |
|
74 | + } |
|
75 | 75 | } |
76 | 76 | ?> |
77 | 77 | \ No newline at end of file |
@@ -12,18 +12,18 @@ discard block |
||
12 | 12 | 'listing_type' => 'gd_place', |
13 | 13 | 'data_type' => '', |
14 | 14 | 'field_type' => 'select', |
15 | - 'admin_title' => __( 'Place Type', 'test' ), |
|
16 | - 'admin_desc' => __( 'Select the place type.', 'test' ), |
|
17 | - 'site_title' => __( 'Place Type', 'test' ), |
|
15 | + 'admin_title' => __('Place Type', 'test'), |
|
16 | + 'admin_desc' => __('Select the place type.', 'test'), |
|
17 | + 'site_title' => __('Place Type', 'test'), |
|
18 | 18 | 'htmlvar_name' => 'test_place_type', |
19 | 19 | 'default_value' => '', |
20 | 20 | 'option_values' => 'Hotel,Bar,Restaurant,Pub', |
21 | 21 | 'is_default' => '1', |
22 | 22 | 'is_admin' => '1', |
23 | - 'clabels' => __( 'Place Type', 'test' ) |
|
23 | + 'clabels' => __('Place Type', 'test') |
|
24 | 24 | ); |
25 | 25 | |
26 | - $lastid = geodir_custom_field_save( $field ); |
|
26 | + $lastid = geodir_custom_field_save($field); |
|
27 | 27 | |
28 | 28 | $this->assertTrue(is_int($lastid)); |
29 | 29 | |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | 'listing_type' => 'gd_place', |
33 | 33 | 'data_type' => 'VARCHAR', |
34 | 34 | 'field_type' => 'url', |
35 | - 'admin_title' => __( 'Website Link', 'test' ), |
|
36 | - 'admin_desc' => __( 'Enter the website link.', 'test' ), |
|
37 | - 'site_title' => __( 'Website Link', 'test' ), |
|
35 | + 'admin_title' => __('Website Link', 'test'), |
|
36 | + 'admin_desc' => __('Enter the website link.', 'test'), |
|
37 | + 'site_title' => __('Website Link', 'test'), |
|
38 | 38 | 'htmlvar_name' => 'test_ws_link', |
39 | 39 | 'default_value' => '', |
40 | 40 | 'option_values' => '', |
41 | 41 | 'is_default' => '1', |
42 | 42 | 'is_admin' => '1', |
43 | - 'clabels' => __( 'Website Link', 'test' ) |
|
43 | + 'clabels' => __('Website Link', 'test') |
|
44 | 44 | ); |
45 | 45 | |
46 | - $lastid2 = geodir_custom_field_save( $field2 ); |
|
46 | + $lastid2 = geodir_custom_field_save($field2); |
|
47 | 47 | |
48 | 48 | $this->assertTrue(is_int($lastid2)); |
49 | 49 | |
@@ -52,20 +52,20 @@ discard block |
||
52 | 52 | 'listing_type' => 'gd_place', |
53 | 53 | 'data_type' => '', |
54 | 54 | 'field_type' => 'select', |
55 | - 'admin_title' => __( 'Place Type', 'test' ), |
|
56 | - 'admin_desc' => __( 'Select the place type.', 'test' ), |
|
57 | - 'site_title' => __( 'Place Type', 'test' ), |
|
55 | + 'admin_title' => __('Place Type', 'test'), |
|
56 | + 'admin_desc' => __('Select the place type.', 'test'), |
|
57 | + 'site_title' => __('Place Type', 'test'), |
|
58 | 58 | 'htmlvar_name' => 'test_place_type', |
59 | 59 | 'default_value' => '', |
60 | 60 | 'option_values' => 'Hotel,Bar,Restaurant,Pub', |
61 | 61 | 'is_default' => '1', |
62 | 62 | 'is_admin' => '1', |
63 | - 'clabels' => __( 'Place Type', 'test' ) |
|
63 | + 'clabels' => __('Place Type', 'test') |
|
64 | 64 | ); |
65 | 65 | |
66 | - $error = geodir_custom_field_save( $field3 ); |
|
66 | + $error = geodir_custom_field_save($field3); |
|
67 | 67 | |
68 | - $this->assertContains( 'HTML Variable Name should be a unique name', $error ); |
|
68 | + $this->assertContains('HTML Variable Name should be a unique name', $error); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | public function tearDown() |