@@ -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,92 +1,92 @@ |
||
1 | 1 | <?php |
2 | 2 | class CheckNotifications 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 testSendFriendEmail() |
|
10 | - { |
|
11 | - add_filter('wp_mail', 'print_mail'); |
|
12 | - ob_start(); |
|
13 | - geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_friend'); |
|
14 | - $output = ob_get_clean(); |
|
15 | - remove_filter('wp_mail', 'print_mail'); |
|
16 | - $this->assertContains( 'thought you might be interested in', $output ); |
|
17 | - $this->assertContains( 'Your friend has sent you a message from', $output ); |
|
18 | - $this->assertContains( '[email protected]', $output ); |
|
19 | - $this->assertContains( 'ADMIN BCC COPY', $output ); |
|
20 | - } |
|
9 | + public function testSendFriendEmail() |
|
10 | + { |
|
11 | + add_filter('wp_mail', 'print_mail'); |
|
12 | + ob_start(); |
|
13 | + geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_friend'); |
|
14 | + $output = ob_get_clean(); |
|
15 | + remove_filter('wp_mail', 'print_mail'); |
|
16 | + $this->assertContains( 'thought you might be interested in', $output ); |
|
17 | + $this->assertContains( 'Your friend has sent you a message from', $output ); |
|
18 | + $this->assertContains( '[email protected]', $output ); |
|
19 | + $this->assertContains( 'ADMIN BCC COPY', $output ); |
|
20 | + } |
|
21 | 21 | |
22 | - public function testSendEnquiryEmail() |
|
23 | - { |
|
24 | - add_filter('wp_mail', 'print_mail'); |
|
25 | - ob_start(); |
|
26 | - geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_enquiry'); |
|
27 | - $output = ob_get_clean(); |
|
28 | - remove_filter('wp_mail', 'print_mail'); |
|
29 | - $this->assertContains( 'Website Enquiry', $output ); |
|
30 | - $this->assertContains( 'An enquiry has been sent from', $output ); |
|
31 | - $this->assertContains( '[email protected]', $output ); |
|
32 | - $this->assertContains( 'ADMIN BCC COPY', $output ); |
|
33 | - } |
|
22 | + public function testSendEnquiryEmail() |
|
23 | + { |
|
24 | + add_filter('wp_mail', 'print_mail'); |
|
25 | + ob_start(); |
|
26 | + geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_enquiry'); |
|
27 | + $output = ob_get_clean(); |
|
28 | + remove_filter('wp_mail', 'print_mail'); |
|
29 | + $this->assertContains( 'Website Enquiry', $output ); |
|
30 | + $this->assertContains( 'An enquiry has been sent from', $output ); |
|
31 | + $this->assertContains( '[email protected]', $output ); |
|
32 | + $this->assertContains( 'ADMIN BCC COPY', $output ); |
|
33 | + } |
|
34 | 34 | |
35 | - public function testForgotPassEmail() |
|
36 | - { |
|
37 | - add_filter('wp_mail', 'print_mail'); |
|
38 | - ob_start(); |
|
39 | - geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'forgot_password'); |
|
40 | - $output = ob_get_clean(); |
|
41 | - remove_filter('wp_mail', 'print_mail'); |
|
42 | - $this->assertContains( 'Your new password', $output ); |
|
43 | - $this->assertContains( 'You requested a new password for', $output ); |
|
44 | - $this->assertContains( '[email protected]', $output ); |
|
45 | - } |
|
35 | + public function testForgotPassEmail() |
|
36 | + { |
|
37 | + add_filter('wp_mail', 'print_mail'); |
|
38 | + ob_start(); |
|
39 | + geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'forgot_password'); |
|
40 | + $output = ob_get_clean(); |
|
41 | + remove_filter('wp_mail', 'print_mail'); |
|
42 | + $this->assertContains( 'Your new password', $output ); |
|
43 | + $this->assertContains( 'You requested a new password for', $output ); |
|
44 | + $this->assertContains( '[email protected]', $output ); |
|
45 | + } |
|
46 | 46 | |
47 | - public function testRegistrationEmail() |
|
48 | - { |
|
49 | - add_filter('wp_mail', 'print_mail'); |
|
50 | - ob_start(); |
|
51 | - geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'registration'); |
|
52 | - $output = ob_get_clean(); |
|
53 | - remove_filter('wp_mail', 'print_mail'); |
|
54 | - $this->assertContains( 'Your Log In Details', $output ); |
|
55 | - $this->assertContains( 'You can log in with the following information', $output ); |
|
56 | - $this->assertContains( '[email protected]', $output ); |
|
57 | - $this->assertContains( 'ADMIN BCC COPY', $output ); |
|
58 | - } |
|
47 | + public function testRegistrationEmail() |
|
48 | + { |
|
49 | + add_filter('wp_mail', 'print_mail'); |
|
50 | + ob_start(); |
|
51 | + geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'registration'); |
|
52 | + $output = ob_get_clean(); |
|
53 | + remove_filter('wp_mail', 'print_mail'); |
|
54 | + $this->assertContains( 'Your Log In Details', $output ); |
|
55 | + $this->assertContains( 'You can log in with the following information', $output ); |
|
56 | + $this->assertContains( '[email protected]', $output ); |
|
57 | + $this->assertContains( 'ADMIN BCC COPY', $output ); |
|
58 | + } |
|
59 | 59 | |
60 | - public function testPostSubmitEmail() |
|
61 | - { |
|
62 | - add_filter('wp_mail', 'print_mail'); |
|
63 | - ob_start(); |
|
64 | - geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'post_submit'); |
|
65 | - $output = ob_get_clean(); |
|
66 | - remove_filter('wp_mail', 'print_mail'); |
|
67 | - $this->assertContains( 'Post Submitted Successfully', $output ); |
|
68 | - $this->assertContains( 'You submitted the below listing information', $output ); |
|
69 | - $this->assertContains( '[email protected]', $output ); |
|
70 | - $this->assertContains( 'ADMIN BCC COPY', $output ); |
|
71 | - $this->assertContains( 'A new listing has been published', $output ); |
|
72 | - } |
|
60 | + public function testPostSubmitEmail() |
|
61 | + { |
|
62 | + add_filter('wp_mail', 'print_mail'); |
|
63 | + ob_start(); |
|
64 | + geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'post_submit'); |
|
65 | + $output = ob_get_clean(); |
|
66 | + remove_filter('wp_mail', 'print_mail'); |
|
67 | + $this->assertContains( 'Post Submitted Successfully', $output ); |
|
68 | + $this->assertContains( 'You submitted the below listing information', $output ); |
|
69 | + $this->assertContains( '[email protected]', $output ); |
|
70 | + $this->assertContains( 'ADMIN BCC COPY', $output ); |
|
71 | + $this->assertContains( 'A new listing has been published', $output ); |
|
72 | + } |
|
73 | 73 | |
74 | - public function testListingPublishedEmail() |
|
75 | - { |
|
76 | - add_filter('wp_mail', 'print_mail'); |
|
77 | - ob_start(); |
|
78 | - geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'listing_published'); |
|
79 | - $output = ob_get_clean(); |
|
80 | - remove_filter('wp_mail', 'print_mail'); |
|
81 | - $this->assertContains( 'Listing Published Successfully', $output ); |
|
82 | - $this->assertContains( 'Your listing has been published', $output ); |
|
83 | - $this->assertContains( '[email protected]', $output ); |
|
84 | - $this->assertContains( 'ADMIN BCC COPY', $output ); |
|
85 | - } |
|
74 | + public function testListingPublishedEmail() |
|
75 | + { |
|
76 | + add_filter('wp_mail', 'print_mail'); |
|
77 | + ob_start(); |
|
78 | + geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'listing_published'); |
|
79 | + $output = ob_get_clean(); |
|
80 | + remove_filter('wp_mail', 'print_mail'); |
|
81 | + $this->assertContains( 'Listing Published Successfully', $output ); |
|
82 | + $this->assertContains( 'Your listing has been published', $output ); |
|
83 | + $this->assertContains( '[email protected]', $output ); |
|
84 | + $this->assertContains( 'ADMIN BCC COPY', $output ); |
|
85 | + } |
|
86 | 86 | |
87 | - public function tearDown() |
|
88 | - { |
|
89 | - parent::tearDown(); |
|
90 | - } |
|
87 | + public function tearDown() |
|
88 | + { |
|
89 | + parent::tearDown(); |
|
90 | + } |
|
91 | 91 | } |
92 | 92 | ?> |
93 | 93 | \ No newline at end of file |
@@ -10,78 +10,78 @@ |
||
10 | 10 | { |
11 | 11 | add_filter('wp_mail', 'print_mail'); |
12 | 12 | ob_start(); |
13 | - geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_friend'); |
|
13 | + geodir_sendEmail('', '', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_friend'); |
|
14 | 14 | $output = ob_get_clean(); |
15 | 15 | remove_filter('wp_mail', 'print_mail'); |
16 | - $this->assertContains( 'thought you might be interested in', $output ); |
|
17 | - $this->assertContains( 'Your friend has sent you a message from', $output ); |
|
18 | - $this->assertContains( '[email protected]', $output ); |
|
19 | - $this->assertContains( 'ADMIN BCC COPY', $output ); |
|
16 | + $this->assertContains('thought you might be interested in', $output); |
|
17 | + $this->assertContains('Your friend has sent you a message from', $output); |
|
18 | + $this->assertContains('[email protected]', $output); |
|
19 | + $this->assertContains('ADMIN BCC COPY', $output); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function testSendEnquiryEmail() |
23 | 23 | { |
24 | 24 | add_filter('wp_mail', 'print_mail'); |
25 | 25 | ob_start(); |
26 | - geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_enquiry'); |
|
26 | + geodir_sendEmail('', '', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_enquiry'); |
|
27 | 27 | $output = ob_get_clean(); |
28 | 28 | remove_filter('wp_mail', 'print_mail'); |
29 | - $this->assertContains( 'Website Enquiry', $output ); |
|
30 | - $this->assertContains( 'An enquiry has been sent from', $output ); |
|
31 | - $this->assertContains( '[email protected]', $output ); |
|
32 | - $this->assertContains( 'ADMIN BCC COPY', $output ); |
|
29 | + $this->assertContains('Website Enquiry', $output); |
|
30 | + $this->assertContains('An enquiry has been sent from', $output); |
|
31 | + $this->assertContains('[email protected]', $output); |
|
32 | + $this->assertContains('ADMIN BCC COPY', $output); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function testForgotPassEmail() |
36 | 36 | { |
37 | 37 | add_filter('wp_mail', 'print_mail'); |
38 | 38 | ob_start(); |
39 | - geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'forgot_password'); |
|
39 | + geodir_sendEmail('', '', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'forgot_password'); |
|
40 | 40 | $output = ob_get_clean(); |
41 | 41 | remove_filter('wp_mail', 'print_mail'); |
42 | - $this->assertContains( 'Your new password', $output ); |
|
43 | - $this->assertContains( 'You requested a new password for', $output ); |
|
44 | - $this->assertContains( '[email protected]', $output ); |
|
42 | + $this->assertContains('Your new password', $output); |
|
43 | + $this->assertContains('You requested a new password for', $output); |
|
44 | + $this->assertContains('[email protected]', $output); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public function testRegistrationEmail() |
48 | 48 | { |
49 | 49 | add_filter('wp_mail', 'print_mail'); |
50 | 50 | ob_start(); |
51 | - geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'registration'); |
|
51 | + geodir_sendEmail('', '', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'registration'); |
|
52 | 52 | $output = ob_get_clean(); |
53 | 53 | remove_filter('wp_mail', 'print_mail'); |
54 | - $this->assertContains( 'Your Log In Details', $output ); |
|
55 | - $this->assertContains( 'You can log in with the following information', $output ); |
|
56 | - $this->assertContains( '[email protected]', $output ); |
|
57 | - $this->assertContains( 'ADMIN BCC COPY', $output ); |
|
54 | + $this->assertContains('Your Log In Details', $output); |
|
55 | + $this->assertContains('You can log in with the following information', $output); |
|
56 | + $this->assertContains('[email protected]', $output); |
|
57 | + $this->assertContains('ADMIN BCC COPY', $output); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | public function testPostSubmitEmail() |
61 | 61 | { |
62 | 62 | add_filter('wp_mail', 'print_mail'); |
63 | 63 | ob_start(); |
64 | - geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'post_submit'); |
|
64 | + geodir_sendEmail('', '', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'post_submit'); |
|
65 | 65 | $output = ob_get_clean(); |
66 | 66 | remove_filter('wp_mail', 'print_mail'); |
67 | - $this->assertContains( 'Post Submitted Successfully', $output ); |
|
68 | - $this->assertContains( 'You submitted the below listing information', $output ); |
|
69 | - $this->assertContains( '[email protected]', $output ); |
|
70 | - $this->assertContains( 'ADMIN BCC COPY', $output ); |
|
71 | - $this->assertContains( 'A new listing has been published', $output ); |
|
67 | + $this->assertContains('Post Submitted Successfully', $output); |
|
68 | + $this->assertContains('You submitted the below listing information', $output); |
|
69 | + $this->assertContains('[email protected]', $output); |
|
70 | + $this->assertContains('ADMIN BCC COPY', $output); |
|
71 | + $this->assertContains('A new listing has been published', $output); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function testListingPublishedEmail() |
75 | 75 | { |
76 | 76 | add_filter('wp_mail', 'print_mail'); |
77 | 77 | ob_start(); |
78 | - geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'listing_published'); |
|
78 | + geodir_sendEmail('', '', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'listing_published'); |
|
79 | 79 | $output = ob_get_clean(); |
80 | 80 | remove_filter('wp_mail', 'print_mail'); |
81 | - $this->assertContains( 'Listing Published Successfully', $output ); |
|
82 | - $this->assertContains( 'Your listing has been published', $output ); |
|
83 | - $this->assertContains( '[email protected]', $output ); |
|
84 | - $this->assertContains( 'ADMIN BCC COPY', $output ); |
|
81 | + $this->assertContains('Listing Published Successfully', $output); |
|
82 | + $this->assertContains('Your listing has been published', $output); |
|
83 | + $this->assertContains('[email protected]', $output); |
|
84 | + $this->assertContains('ADMIN BCC COPY', $output); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | public function tearDown() |
@@ -29,7 +29,7 @@ |
||
29 | 29 | 'post_type' => 'gd_place' |
30 | 30 | ); |
31 | 31 | |
32 | - $all_posts = new WP_Query( $query_args ); |
|
32 | + $all_posts = new WP_Query($query_args); |
|
33 | 33 | |
34 | 34 | $total_posts = $all_posts->found_posts; |
35 | 35 |
@@ -1,50 +1,50 @@ |
||
1 | 1 | <?php |
2 | 2 | class TestDummyData extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - wp_set_current_user(1); |
|
8 | - geodir_delete_dummy_posts(); |
|
9 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + wp_set_current_user(1); |
|
8 | + geodir_delete_dummy_posts(); |
|
9 | + } |
|
10 | 10 | |
11 | - public function testCreatePlaces() |
|
12 | - { |
|
13 | - global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2; |
|
11 | + public function testCreatePlaces() |
|
12 | + { |
|
13 | + global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2; |
|
14 | 14 | |
15 | - global $geodir_post_custom_fields_cache; |
|
16 | - $geodir_post_custom_fields_cache = array(); |
|
15 | + global $geodir_post_custom_fields_cache; |
|
16 | + $geodir_post_custom_fields_cache = array(); |
|
17 | 17 | |
18 | - $city_bound_lat1 = 40.4960439; |
|
19 | - $city_bound_lng1 = -74.2557349; |
|
20 | - $city_bound_lat2 = 40.91525559999999; |
|
21 | - $city_bound_lng2 = -73.7002721; |
|
18 | + $city_bound_lat1 = 40.4960439; |
|
19 | + $city_bound_lng1 = -74.2557349; |
|
20 | + $city_bound_lat2 = 40.91525559999999; |
|
21 | + $city_bound_lng2 = -73.7002721; |
|
22 | 22 | |
23 | 23 | |
24 | - $dummy_post_index = 30; |
|
25 | - test_create_dummy_posts(30); |
|
24 | + $dummy_post_index = 30; |
|
25 | + test_create_dummy_posts(30); |
|
26 | 26 | |
27 | - $query_args = array( |
|
28 | - 'post_status' => 'publish', |
|
29 | - 'post_type' => 'gd_place' |
|
30 | - ); |
|
27 | + $query_args = array( |
|
28 | + 'post_status' => 'publish', |
|
29 | + 'post_type' => 'gd_place' |
|
30 | + ); |
|
31 | 31 | |
32 | - $all_posts = new WP_Query( $query_args ); |
|
32 | + $all_posts = new WP_Query( $query_args ); |
|
33 | 33 | |
34 | - $total_posts = $all_posts->found_posts; |
|
34 | + $total_posts = $all_posts->found_posts; |
|
35 | 35 | |
36 | - $this->assertTrue((int) $total_posts > 0); |
|
36 | + $this->assertTrue((int) $total_posts > 0); |
|
37 | 37 | |
38 | - } |
|
38 | + } |
|
39 | 39 | |
40 | - public function testDeletePlaces() |
|
41 | - { |
|
42 | - geodir_delete_dummy_posts(); |
|
43 | - } |
|
40 | + public function testDeletePlaces() |
|
41 | + { |
|
42 | + geodir_delete_dummy_posts(); |
|
43 | + } |
|
44 | 44 | |
45 | - public function tearDown() |
|
46 | - { |
|
47 | - parent::tearDown(); |
|
48 | - } |
|
45 | + public function tearDown() |
|
46 | + { |
|
47 | + parent::tearDown(); |
|
48 | + } |
|
49 | 49 | } |
50 | 50 | ?> |
51 | 51 | \ No newline at end of file |
@@ -1,19 +1,19 @@ |
||
1 | 1 | <?php |
2 | 2 | class ImportExport 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 testImportExport() |
|
10 | - { |
|
9 | + public function testImportExport() |
|
10 | + { |
|
11 | 11 | |
12 | - } |
|
12 | + } |
|
13 | 13 | |
14 | - public function tearDown() |
|
15 | - { |
|
16 | - parent::tearDown(); |
|
17 | - } |
|
14 | + public function tearDown() |
|
15 | + { |
|
16 | + parent::tearDown(); |
|
17 | + } |
|
18 | 18 | } |
19 | 19 | ?> |
20 | 20 | \ No newline at end of file |
@@ -10,6 +10,9 @@ discard block |
||
10 | 10 | $this->setBrowserUrl(self::GDTEST_BASE_URL); |
11 | 11 | } |
12 | 12 | |
13 | + /** |
|
14 | + * @param string $search |
|
15 | + */ |
|
13 | 16 | function isTextPresent($search) |
14 | 17 | { |
15 | 18 | $source = $this->source(); |
@@ -62,6 +65,9 @@ discard block |
||
62 | 65 | } |
63 | 66 | } |
64 | 67 | |
68 | + /** |
|
69 | + * @param string $redirect |
|
70 | + */ |
|
65 | 71 | function maybeUserLogin($redirect, $force=false) { |
66 | 72 | if ($force) { |
67 | 73 | $this->url(self::GDTEST_BASE_URL.'wp-admin/'); |
@@ -87,6 +93,9 @@ discard block |
||
87 | 93 | } |
88 | 94 | } |
89 | 95 | |
96 | + /** |
|
97 | + * @param string $redirect |
|
98 | + */ |
|
90 | 99 | function maybeAdminLogin($redirect) { |
91 | 100 | $this->url($redirect); |
92 | 101 | $this->waitForPageLoadAndCheckForErrors(); |
@@ -121,6 +130,9 @@ discard block |
||
121 | 130 | return $exists; |
122 | 131 | } |
123 | 132 | |
133 | + /** |
|
134 | + * @param string $script |
|
135 | + */ |
|
124 | 136 | function ExecuteScript($script, $args=array()) { |
125 | 137 | $this->execute( array( |
126 | 138 | 'script' => $script , |
@@ -133,10 +145,16 @@ discard block |
||
133 | 145 | $this->ExecuteScript('jQuery("#wpadminbar").hide();'); |
134 | 146 | } |
135 | 147 | |
148 | + /** |
|
149 | + * @param string $string |
|
150 | + */ |
|
136 | 151 | function logInfo($string) { |
137 | 152 | fwrite(STDOUT, "Info: ".$string . PHP_EOL); |
138 | 153 | } |
139 | 154 | |
155 | + /** |
|
156 | + * @param string $string |
|
157 | + */ |
|
140 | 158 | function logError($string) { |
141 | 159 | fwrite(STDOUT, "Error: ".$string . PHP_EOL); |
142 | 160 | } |
@@ -157,6 +175,10 @@ discard block |
||
157 | 175 | return (int) $content; |
158 | 176 | } |
159 | 177 | |
178 | + /** |
|
179 | + * @param integer $current |
|
180 | + * @param integer $completed |
|
181 | + */ |
|
160 | 182 | function skipTest($current, $completed) { |
161 | 183 | if ($completed == 0 || $completed == 42 || $current == $completed) { |
162 | 184 | return false; |
@@ -1,199 +1,199 @@ |
||
1 | 1 | <?php |
2 | 2 | class GD_Test extends PHPUnit_Extensions_Selenium2TestCase { |
3 | 3 | |
4 | - const GDTEST_BASE_URL = 'http://www.test.ci/selpress/'; |
|
5 | - |
|
6 | - public function setUp() |
|
7 | - { |
|
8 | - $this->setSeleniumServerRequestsTimeout(300); |
|
9 | - $this->setBrowser('firefox'); |
|
10 | - $this->setBrowserUrl(self::GDTEST_BASE_URL); |
|
11 | - } |
|
12 | - |
|
13 | - function isTextPresent($search) |
|
14 | - { |
|
15 | - $source = $this->source(); |
|
16 | - if ( strpos((string)$source,$search) !== FALSE) { |
|
17 | - return true; |
|
18 | - } else { |
|
19 | - return false; |
|
20 | - } |
|
21 | - } |
|
22 | - |
|
23 | - function randomEmailID() |
|
24 | - { |
|
25 | - return md5(uniqid(rand(), true)).'@gmail.com'; |
|
26 | - } |
|
27 | - |
|
28 | - function waitForPageLoadAndCheckForErrors($timeout=10000) |
|
29 | - { |
|
30 | - // Wait 10 seconds |
|
31 | - $this->timeouts()->implicitWait($timeout); |
|
32 | - $this->checkForErrors(); |
|
33 | - $this->checkForJsErrors(); |
|
34 | - } |
|
35 | - |
|
36 | - function checkForErrors() |
|
37 | - { |
|
38 | - $elements = $this->elements($this->using('css selector')->value('.xdebug-error')); |
|
39 | - if ($elements) { |
|
40 | - $total = count($elements); |
|
41 | - fwrite(STDOUT, $total.' errors found'. PHP_EOL); |
|
42 | - $count = 0; |
|
43 | - foreach ($elements as $i => $element) { |
|
44 | - $count++; |
|
45 | - if ($errors = $element->attribute('innerHTML')) { |
|
46 | - fwrite(STDOUT, "========================================================================". PHP_EOL); |
|
47 | - fwrite(STDOUT, strip_tags($errors). PHP_EOL); |
|
48 | - if ($count == $total) { |
|
49 | - fwrite(STDOUT, "========================================================================". PHP_EOL); |
|
50 | - } |
|
51 | - } |
|
52 | - } |
|
53 | - } |
|
54 | - } |
|
55 | - |
|
56 | - function checkForJsErrors() { |
|
57 | - if ($this->isElementExists('sel_js_error')) { |
|
58 | - fwrite(STDOUT, 'Javascript errors found'. PHP_EOL); |
|
59 | - fwrite(STDOUT, "========================================================================". PHP_EOL); |
|
60 | - echo $this->byId('sel_js_error')->attribute('innerHTML'); |
|
61 | - fwrite(STDOUT, "========================================================================". PHP_EOL); |
|
62 | - } |
|
63 | - } |
|
64 | - |
|
65 | - function maybeUserLogin($redirect, $force=false) { |
|
66 | - if ($force) { |
|
67 | - $this->url(self::GDTEST_BASE_URL.'wp-admin/'); |
|
68 | - if ($this->isTextPresent("forgetmenot")) { |
|
69 | - $this->byId('user_login')->value('[email protected]'); |
|
70 | - $this->byId('user_pass')->value('1'); |
|
4 | + const GDTEST_BASE_URL = 'http://www.test.ci/selpress/'; |
|
5 | + |
|
6 | + public function setUp() |
|
7 | + { |
|
8 | + $this->setSeleniumServerRequestsTimeout(300); |
|
9 | + $this->setBrowser('firefox'); |
|
10 | + $this->setBrowserUrl(self::GDTEST_BASE_URL); |
|
11 | + } |
|
12 | + |
|
13 | + function isTextPresent($search) |
|
14 | + { |
|
15 | + $source = $this->source(); |
|
16 | + if ( strpos((string)$source,$search) !== FALSE) { |
|
17 | + return true; |
|
18 | + } else { |
|
19 | + return false; |
|
20 | + } |
|
21 | + } |
|
22 | + |
|
23 | + function randomEmailID() |
|
24 | + { |
|
25 | + return md5(uniqid(rand(), true)).'@gmail.com'; |
|
26 | + } |
|
27 | + |
|
28 | + function waitForPageLoadAndCheckForErrors($timeout=10000) |
|
29 | + { |
|
30 | + // Wait 10 seconds |
|
31 | + $this->timeouts()->implicitWait($timeout); |
|
32 | + $this->checkForErrors(); |
|
33 | + $this->checkForJsErrors(); |
|
34 | + } |
|
35 | + |
|
36 | + function checkForErrors() |
|
37 | + { |
|
38 | + $elements = $this->elements($this->using('css selector')->value('.xdebug-error')); |
|
39 | + if ($elements) { |
|
40 | + $total = count($elements); |
|
41 | + fwrite(STDOUT, $total.' errors found'. PHP_EOL); |
|
42 | + $count = 0; |
|
43 | + foreach ($elements as $i => $element) { |
|
44 | + $count++; |
|
45 | + if ($errors = $element->attribute('innerHTML')) { |
|
46 | + fwrite(STDOUT, "========================================================================". PHP_EOL); |
|
47 | + fwrite(STDOUT, strip_tags($errors). PHP_EOL); |
|
48 | + if ($count == $total) { |
|
49 | + fwrite(STDOUT, "========================================================================". PHP_EOL); |
|
50 | + } |
|
51 | + } |
|
52 | + } |
|
53 | + } |
|
54 | + } |
|
55 | + |
|
56 | + function checkForJsErrors() { |
|
57 | + if ($this->isElementExists('sel_js_error')) { |
|
58 | + fwrite(STDOUT, 'Javascript errors found'. PHP_EOL); |
|
59 | + fwrite(STDOUT, "========================================================================". PHP_EOL); |
|
60 | + echo $this->byId('sel_js_error')->attribute('innerHTML'); |
|
61 | + fwrite(STDOUT, "========================================================================". PHP_EOL); |
|
62 | + } |
|
63 | + } |
|
64 | + |
|
65 | + function maybeUserLogin($redirect, $force=false) { |
|
66 | + if ($force) { |
|
67 | + $this->url(self::GDTEST_BASE_URL.'wp-admin/'); |
|
68 | + if ($this->isTextPresent("forgetmenot")) { |
|
69 | + $this->byId('user_login')->value('[email protected]'); |
|
70 | + $this->byId('user_pass')->value('1'); |
|
71 | 71 | // $this->byId('rememberme')->click(); |
72 | - // Submit the form |
|
73 | - $this->byId('wp-submit')->submit(); |
|
74 | - $this->waitForPageLoadAndCheckForErrors(); |
|
75 | - } |
|
76 | - } |
|
77 | - $this->url($redirect); |
|
78 | - $this->waitForPageLoadAndCheckForErrors(); |
|
79 | - if ($this->isTextPresent("Sign In")) { |
|
80 | - $this->byId('user_login')->value('[email protected]'); |
|
81 | - $this->byId('user_pass')->value('1'); |
|
72 | + // Submit the form |
|
73 | + $this->byId('wp-submit')->submit(); |
|
74 | + $this->waitForPageLoadAndCheckForErrors(); |
|
75 | + } |
|
76 | + } |
|
77 | + $this->url($redirect); |
|
78 | + $this->waitForPageLoadAndCheckForErrors(); |
|
79 | + if ($this->isTextPresent("Sign In")) { |
|
80 | + $this->byId('user_login')->value('[email protected]'); |
|
81 | + $this->byId('user_pass')->value('1'); |
|
82 | 82 | // $this->byId('rememberme')->click(); |
83 | - // Submit the form |
|
84 | - $this->byId('cus_loginform')->submit(); |
|
85 | - $this->waitForPageLoadAndCheckForErrors(); |
|
86 | - $this->url($redirect); |
|
87 | - } |
|
88 | - } |
|
89 | - |
|
90 | - function maybeAdminLogin($redirect) { |
|
91 | - $this->url($redirect); |
|
92 | - $this->waitForPageLoadAndCheckForErrors(); |
|
93 | - if ($this->isTextPresent("forgetmenot")) { |
|
94 | - $this->byId('user_login')->value('admin'); |
|
95 | - $this->byId('user_pass')->value('admin'); |
|
83 | + // Submit the form |
|
84 | + $this->byId('cus_loginform')->submit(); |
|
85 | + $this->waitForPageLoadAndCheckForErrors(); |
|
86 | + $this->url($redirect); |
|
87 | + } |
|
88 | + } |
|
89 | + |
|
90 | + function maybeAdminLogin($redirect) { |
|
91 | + $this->url($redirect); |
|
92 | + $this->waitForPageLoadAndCheckForErrors(); |
|
93 | + if ($this->isTextPresent("forgetmenot")) { |
|
94 | + $this->byId('user_login')->value('admin'); |
|
95 | + $this->byId('user_pass')->value('admin'); |
|
96 | 96 | // $this->byId('rememberme')->click(); |
97 | - // Submit the form |
|
98 | - $this->byId('wp-submit')->submit(); |
|
99 | - $this->waitForPageLoadAndCheckForErrors(); |
|
100 | - $this->url($redirect); |
|
101 | - } |
|
102 | - } |
|
103 | - |
|
104 | - function isElementExists($id = false, $by = 'id') { |
|
105 | - if (!$id) { |
|
106 | - return false; |
|
107 | - } |
|
108 | - $exists = true; |
|
109 | - try { |
|
110 | - if ($by == 'id') { |
|
111 | - $this->byId($id); |
|
112 | - } elseif ($by == 'xpath') { |
|
113 | - $this->byXPath($id); |
|
114 | - } |
|
115 | - |
|
116 | - } catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) { |
|
117 | - if (PHPUnit_Extensions_Selenium2TestCase_WebDriverException::NoSuchElement == $e->getCode()) { |
|
118 | - $exists = false; |
|
119 | - } |
|
120 | - } |
|
121 | - return $exists; |
|
122 | - } |
|
123 | - |
|
124 | - function ExecuteScript($script, $args=array()) { |
|
125 | - $this->execute( array( |
|
126 | - 'script' => $script , |
|
127 | - 'args'=>$args |
|
128 | - ) ); |
|
129 | - } |
|
130 | - |
|
131 | - function hideAdminBar() { |
|
132 | - //admin bar causes problem with scroll. So hide admin bar while testing. |
|
133 | - $this->ExecuteScript('jQuery("#wpadminbar").hide();'); |
|
134 | - } |
|
135 | - |
|
136 | - function logInfo($string) { |
|
137 | - fwrite(STDOUT, "Info: ".$string . PHP_EOL); |
|
138 | - } |
|
139 | - |
|
140 | - function logError($string) { |
|
141 | - fwrite(STDOUT, "Error: ".$string . PHP_EOL); |
|
142 | - } |
|
143 | - |
|
144 | - function logWarning($string) { |
|
145 | - fwrite(STDOUT, "Warning: ".$string . PHP_EOL); |
|
146 | - } |
|
147 | - |
|
148 | - function getCurrentFileNumber($file) { |
|
149 | - preg_match('/test-([0-9]+)_/', $file, $match); |
|
150 | - return (int) $match[1]; |
|
151 | - } |
|
152 | - |
|
153 | - function getCompletedFileNumber() { |
|
154 | - $completed = fopen("tests/selenium/completed.txt", "r") or die("Unable to open file!"); |
|
155 | - $content = fgets($completed); |
|
156 | - fclose($completed); |
|
157 | - return (int) $content; |
|
158 | - } |
|
159 | - |
|
160 | - function skipTest($current, $completed) { |
|
161 | - if ($completed == 0 || $completed == 42 || $current == $completed) { |
|
162 | - return false; |
|
163 | - } elseif ($current < $completed) { |
|
164 | - return true; |
|
165 | - } else { |
|
166 | - return false; |
|
167 | - } |
|
168 | - } |
|
169 | - |
|
170 | - function maybeLogout() { |
|
171 | - $this->url(self::GDTEST_BASE_URL); |
|
172 | - $this->byXPath("//*[@id='gd-sidebar-wrapper']//ul[@class='geodir-loginbox-list']//a[@class='signin']")->click(); |
|
173 | - $this->waitForPageLoadAndCheckForErrors(); |
|
174 | - } |
|
175 | - |
|
176 | - function maybeAdminLogout() { |
|
177 | - $this->url(self::GDTEST_BASE_URL.'wp-admin/plugins.php'); |
|
178 | - $this->ExecuteScript('jQuery("#wp-admin-bar-my-account").addClass("hover");'); |
|
179 | - $this->byXPath("//*[@id='wp-admin-bar-logout']//a")->click(); |
|
180 | - $this->waitForPageLoadAndCheckForErrors(); |
|
181 | - } |
|
182 | - |
|
183 | - function maybeActivatePlugin($id=false, $timeout=10000) { |
|
184 | - if (!$id) { |
|
185 | - return; |
|
186 | - } |
|
187 | - $plugin_name = ucwords(str_replace('-', ' ', $id)); |
|
188 | - $this->logInfo('Activating '.$plugin_name.' plugin......'); |
|
189 | - $this->url(self::GDTEST_BASE_URL.'wp-admin/plugins.php'); |
|
190 | - $this->waitForPageLoadAndCheckForErrors(); |
|
191 | - $this->hideAdminBar(); |
|
192 | - if (is_int(strpos($this->byId($id)->attribute('class'), 'inactive'))) { |
|
193 | - $this->byXPath("//tr[@id='".$id."']//span[@class='activate']/a")->click(); |
|
194 | - } |
|
195 | - $this->waitForPageLoadAndCheckForErrors($timeout); |
|
196 | - $this->logInfo($plugin_name.' activated......'); |
|
197 | - } |
|
97 | + // Submit the form |
|
98 | + $this->byId('wp-submit')->submit(); |
|
99 | + $this->waitForPageLoadAndCheckForErrors(); |
|
100 | + $this->url($redirect); |
|
101 | + } |
|
102 | + } |
|
103 | + |
|
104 | + function isElementExists($id = false, $by = 'id') { |
|
105 | + if (!$id) { |
|
106 | + return false; |
|
107 | + } |
|
108 | + $exists = true; |
|
109 | + try { |
|
110 | + if ($by == 'id') { |
|
111 | + $this->byId($id); |
|
112 | + } elseif ($by == 'xpath') { |
|
113 | + $this->byXPath($id); |
|
114 | + } |
|
115 | + |
|
116 | + } catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) { |
|
117 | + if (PHPUnit_Extensions_Selenium2TestCase_WebDriverException::NoSuchElement == $e->getCode()) { |
|
118 | + $exists = false; |
|
119 | + } |
|
120 | + } |
|
121 | + return $exists; |
|
122 | + } |
|
123 | + |
|
124 | + function ExecuteScript($script, $args=array()) { |
|
125 | + $this->execute( array( |
|
126 | + 'script' => $script , |
|
127 | + 'args'=>$args |
|
128 | + ) ); |
|
129 | + } |
|
130 | + |
|
131 | + function hideAdminBar() { |
|
132 | + //admin bar causes problem with scroll. So hide admin bar while testing. |
|
133 | + $this->ExecuteScript('jQuery("#wpadminbar").hide();'); |
|
134 | + } |
|
135 | + |
|
136 | + function logInfo($string) { |
|
137 | + fwrite(STDOUT, "Info: ".$string . PHP_EOL); |
|
138 | + } |
|
139 | + |
|
140 | + function logError($string) { |
|
141 | + fwrite(STDOUT, "Error: ".$string . PHP_EOL); |
|
142 | + } |
|
143 | + |
|
144 | + function logWarning($string) { |
|
145 | + fwrite(STDOUT, "Warning: ".$string . PHP_EOL); |
|
146 | + } |
|
147 | + |
|
148 | + function getCurrentFileNumber($file) { |
|
149 | + preg_match('/test-([0-9]+)_/', $file, $match); |
|
150 | + return (int) $match[1]; |
|
151 | + } |
|
152 | + |
|
153 | + function getCompletedFileNumber() { |
|
154 | + $completed = fopen("tests/selenium/completed.txt", "r") or die("Unable to open file!"); |
|
155 | + $content = fgets($completed); |
|
156 | + fclose($completed); |
|
157 | + return (int) $content; |
|
158 | + } |
|
159 | + |
|
160 | + function skipTest($current, $completed) { |
|
161 | + if ($completed == 0 || $completed == 42 || $current == $completed) { |
|
162 | + return false; |
|
163 | + } elseif ($current < $completed) { |
|
164 | + return true; |
|
165 | + } else { |
|
166 | + return false; |
|
167 | + } |
|
168 | + } |
|
169 | + |
|
170 | + function maybeLogout() { |
|
171 | + $this->url(self::GDTEST_BASE_URL); |
|
172 | + $this->byXPath("//*[@id='gd-sidebar-wrapper']//ul[@class='geodir-loginbox-list']//a[@class='signin']")->click(); |
|
173 | + $this->waitForPageLoadAndCheckForErrors(); |
|
174 | + } |
|
175 | + |
|
176 | + function maybeAdminLogout() { |
|
177 | + $this->url(self::GDTEST_BASE_URL.'wp-admin/plugins.php'); |
|
178 | + $this->ExecuteScript('jQuery("#wp-admin-bar-my-account").addClass("hover");'); |
|
179 | + $this->byXPath("//*[@id='wp-admin-bar-logout']//a")->click(); |
|
180 | + $this->waitForPageLoadAndCheckForErrors(); |
|
181 | + } |
|
182 | + |
|
183 | + function maybeActivatePlugin($id=false, $timeout=10000) { |
|
184 | + if (!$id) { |
|
185 | + return; |
|
186 | + } |
|
187 | + $plugin_name = ucwords(str_replace('-', ' ', $id)); |
|
188 | + $this->logInfo('Activating '.$plugin_name.' plugin......'); |
|
189 | + $this->url(self::GDTEST_BASE_URL.'wp-admin/plugins.php'); |
|
190 | + $this->waitForPageLoadAndCheckForErrors(); |
|
191 | + $this->hideAdminBar(); |
|
192 | + if (is_int(strpos($this->byId($id)->attribute('class'), 'inactive'))) { |
|
193 | + $this->byXPath("//tr[@id='".$id."']//span[@class='activate']/a")->click(); |
|
194 | + } |
|
195 | + $this->waitForPageLoadAndCheckForErrors($timeout); |
|
196 | + $this->logInfo($plugin_name.' activated......'); |
|
197 | + } |
|
198 | 198 | |
199 | 199 | } |
200 | 200 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | function isTextPresent($search) |
14 | 14 | { |
15 | 15 | $source = $this->source(); |
16 | - if ( strpos((string)$source,$search) !== FALSE) { |
|
16 | + if (strpos((string) $source, $search) !== FALSE) { |
|
17 | 17 | return true; |
18 | 18 | } else { |
19 | 19 | return false; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | return md5(uniqid(rand(), true)).'@gmail.com'; |
26 | 26 | } |
27 | 27 | |
28 | - function waitForPageLoadAndCheckForErrors($timeout=10000) |
|
28 | + function waitForPageLoadAndCheckForErrors($timeout = 10000) |
|
29 | 29 | { |
30 | 30 | // Wait 10 seconds |
31 | 31 | $this->timeouts()->implicitWait($timeout); |
@@ -38,15 +38,15 @@ discard block |
||
38 | 38 | $elements = $this->elements($this->using('css selector')->value('.xdebug-error')); |
39 | 39 | if ($elements) { |
40 | 40 | $total = count($elements); |
41 | - fwrite(STDOUT, $total.' errors found'. PHP_EOL); |
|
41 | + fwrite(STDOUT, $total.' errors found'.PHP_EOL); |
|
42 | 42 | $count = 0; |
43 | 43 | foreach ($elements as $i => $element) { |
44 | 44 | $count++; |
45 | 45 | if ($errors = $element->attribute('innerHTML')) { |
46 | - fwrite(STDOUT, "========================================================================". PHP_EOL); |
|
47 | - fwrite(STDOUT, strip_tags($errors). PHP_EOL); |
|
46 | + fwrite(STDOUT, "========================================================================".PHP_EOL); |
|
47 | + fwrite(STDOUT, strip_tags($errors).PHP_EOL); |
|
48 | 48 | if ($count == $total) { |
49 | - fwrite(STDOUT, "========================================================================". PHP_EOL); |
|
49 | + fwrite(STDOUT, "========================================================================".PHP_EOL); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | } |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | |
56 | 56 | function checkForJsErrors() { |
57 | 57 | if ($this->isElementExists('sel_js_error')) { |
58 | - fwrite(STDOUT, 'Javascript errors found'. PHP_EOL); |
|
59 | - fwrite(STDOUT, "========================================================================". PHP_EOL); |
|
58 | + fwrite(STDOUT, 'Javascript errors found'.PHP_EOL); |
|
59 | + fwrite(STDOUT, "========================================================================".PHP_EOL); |
|
60 | 60 | echo $this->byId('sel_js_error')->attribute('innerHTML'); |
61 | - fwrite(STDOUT, "========================================================================". PHP_EOL); |
|
61 | + fwrite(STDOUT, "========================================================================".PHP_EOL); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | - function maybeUserLogin($redirect, $force=false) { |
|
65 | + function maybeUserLogin($redirect, $force = false) { |
|
66 | 66 | if ($force) { |
67 | 67 | $this->url(self::GDTEST_BASE_URL.'wp-admin/'); |
68 | 68 | if ($this->isTextPresent("forgetmenot")) { |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | return $exists; |
122 | 122 | } |
123 | 123 | |
124 | - function ExecuteScript($script, $args=array()) { |
|
125 | - $this->execute( array( |
|
126 | - 'script' => $script , |
|
124 | + function ExecuteScript($script, $args = array()) { |
|
125 | + $this->execute(array( |
|
126 | + 'script' => $script, |
|
127 | 127 | 'args'=>$args |
128 | - ) ); |
|
128 | + )); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | function hideAdminBar() { |
@@ -134,15 +134,15 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | function logInfo($string) { |
137 | - fwrite(STDOUT, "Info: ".$string . PHP_EOL); |
|
137 | + fwrite(STDOUT, "Info: ".$string.PHP_EOL); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | function logError($string) { |
141 | - fwrite(STDOUT, "Error: ".$string . PHP_EOL); |
|
141 | + fwrite(STDOUT, "Error: ".$string.PHP_EOL); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | function logWarning($string) { |
145 | - fwrite(STDOUT, "Warning: ".$string . PHP_EOL); |
|
145 | + fwrite(STDOUT, "Warning: ".$string.PHP_EOL); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | function getCurrentFileNumber($file) { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $this->waitForPageLoadAndCheckForErrors(); |
181 | 181 | } |
182 | 182 | |
183 | - function maybeActivatePlugin($id=false, $timeout=10000) { |
|
183 | + function maybeActivatePlugin($id = false, $timeout = 10000) { |
|
184 | 184 | if (!$id) { |
185 | 185 | return; |
186 | 186 | } |
@@ -1,42 +1,42 @@ |
||
1 | 1 | <?php |
2 | 2 | class SendEnquiry extends GD_Test |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | 7 | |
8 | - //skip test if already completed. |
|
9 | - if ($this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
10 | - $this->markTestSkipped('Skipping '.pathinfo(__FILE__, PATHINFO_FILENAME).' since its already completed......'); |
|
11 | - return; |
|
12 | - } else { |
|
13 | - $this->prepareSession()->currentWindow()->maximize(); |
|
14 | - } |
|
15 | - } |
|
8 | + //skip test if already completed. |
|
9 | + if ($this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
10 | + $this->markTestSkipped('Skipping '.pathinfo(__FILE__, PATHINFO_FILENAME).' since its already completed......'); |
|
11 | + return; |
|
12 | + } else { |
|
13 | + $this->prepareSession()->currentWindow()->maximize(); |
|
14 | + } |
|
15 | + } |
|
16 | 16 | |
17 | - public function testSendEnquiry() |
|
18 | - { |
|
19 | - $this->logInfo('Send Enquiry......'); |
|
20 | - $this->url(self::GDTEST_BASE_URL.'places/united-states/new-york/new-york/attractions/test-listing/'); |
|
21 | - $this->waitForPageLoadAndCheckForErrors(); |
|
22 | - $this->byClassName('b_send_inquiry')->click(); |
|
23 | - $this->waitForPageLoadAndCheckForErrors(); |
|
24 | - $this->byName('inq_name')->value('Test User'); |
|
25 | - $this->byName('inq_email')->value('[email protected]'); |
|
26 | - $this->byId('agt_mail_phone')->value('44444444444'); |
|
27 | - $this->byName('Send')->click(); |
|
28 | - $this->waitForPageLoadAndCheckForErrors(); |
|
29 | - $this->assertTrue( $this->isTextPresent("Enquiry sent successfully"), "Success text not found"); |
|
30 | - } |
|
17 | + public function testSendEnquiry() |
|
18 | + { |
|
19 | + $this->logInfo('Send Enquiry......'); |
|
20 | + $this->url(self::GDTEST_BASE_URL.'places/united-states/new-york/new-york/attractions/test-listing/'); |
|
21 | + $this->waitForPageLoadAndCheckForErrors(); |
|
22 | + $this->byClassName('b_send_inquiry')->click(); |
|
23 | + $this->waitForPageLoadAndCheckForErrors(); |
|
24 | + $this->byName('inq_name')->value('Test User'); |
|
25 | + $this->byName('inq_email')->value('[email protected]'); |
|
26 | + $this->byId('agt_mail_phone')->value('44444444444'); |
|
27 | + $this->byName('Send')->click(); |
|
28 | + $this->waitForPageLoadAndCheckForErrors(); |
|
29 | + $this->assertTrue( $this->isTextPresent("Enquiry sent successfully"), "Success text not found"); |
|
30 | + } |
|
31 | 31 | |
32 | - public function tearDown() |
|
33 | - { |
|
34 | - if (!$this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
35 | - //write current file number to completed.txt |
|
36 | - $CurrentFileNumber = $this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)); |
|
37 | - $completed = fopen("tests/selenium/completed.txt", "w") or die("Unable to open file!"); |
|
38 | - fwrite($completed, $CurrentFileNumber); |
|
39 | - } |
|
40 | - } |
|
32 | + public function tearDown() |
|
33 | + { |
|
34 | + if (!$this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
35 | + //write current file number to completed.txt |
|
36 | + $CurrentFileNumber = $this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)); |
|
37 | + $completed = fopen("tests/selenium/completed.txt", "w") or die("Unable to open file!"); |
|
38 | + fwrite($completed, $CurrentFileNumber); |
|
39 | + } |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | ?> |
43 | 43 | \ No newline at end of file |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $this->byId('agt_mail_phone')->value('44444444444'); |
27 | 27 | $this->byName('Send')->click(); |
28 | 28 | $this->waitForPageLoadAndCheckForErrors(); |
29 | - $this->assertTrue( $this->isTextPresent("Enquiry sent successfully"), "Success text not found"); |
|
29 | + $this->assertTrue($this->isTextPresent("Enquiry sent successfully"), "Success text not found"); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function tearDown() |
@@ -1,74 +1,74 @@ |
||
1 | 1 | <?php |
2 | 2 | class AddCustomFields extends GD_Test |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | 7 | |
8 | - //skip test if already completed. |
|
9 | - if ($this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
10 | - $this->markTestSkipped('Skipping '.pathinfo(__FILE__, PATHINFO_FILENAME).' since its already completed......'); |
|
11 | - return; |
|
12 | - } else { |
|
13 | - $this->prepareSession()->currentWindow()->maximize(); |
|
14 | - } |
|
15 | - } |
|
8 | + //skip test if already completed. |
|
9 | + if ($this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
10 | + $this->markTestSkipped('Skipping '.pathinfo(__FILE__, PATHINFO_FILENAME).' since its already completed......'); |
|
11 | + return; |
|
12 | + } else { |
|
13 | + $this->prepareSession()->currentWindow()->maximize(); |
|
14 | + } |
|
15 | + } |
|
16 | 16 | |
17 | - public function testAddCustomFields() |
|
18 | - { |
|
19 | - $this->logInfo('Add custom fields......'); |
|
20 | - $this->prepareSession()->currentWindow()->maximize(); |
|
21 | - //Field 1 |
|
22 | - $this->maybeAdminLogin(self::GDTEST_BASE_URL.'wp-admin/admin.php?page=geodirectory&tab=gd_place_fields_settings&subtab=custom_fields&listing_type=gd_place'); |
|
23 | - $this->waitForPageLoadAndCheckForErrors(); |
|
24 | - $this->byId('gt-text')->click(); |
|
25 | - $this->waitForPageLoadAndCheckForErrors(); |
|
26 | - $link = $this->byXPath("//li[@id='licontainer_new10']/div[contains(@class,'titlenew10')]"); |
|
27 | - $this->moveto($link); |
|
28 | - $this->doubleclick(); |
|
29 | - $this->waitForPageLoadAndCheckForErrors(); |
|
30 | - $this->byXPath("//div[@id='field_frmnew10']//input[@id='admin_title']")->value('Text Field 1'); |
|
31 | - $this->byXPath("//div[@id='field_frmnew10']//input[@id='site_title']")->value('Text Field 1'); |
|
32 | - $this->byXPath("//div[@id='field_frmnew10']//input[@id='htmlvar_name']")->value('text_field_1'); |
|
33 | - $this->byXPath("//div[@id='field_frmnew10']//input[@id='clabels']")->value('Text Field 1'); |
|
34 | - $this->select($this->byXPath("//div[@id='field_frmnew10']//select[@id='is_active']"))->selectOptionByLabel('Yes'); |
|
35 | - $this->select($this->byXPath("//div[@id='field_frmnew10']//select[@id='show_on_listing']"))->selectOptionByLabel('Yes'); |
|
36 | - $this->select($this->byXPath("//div[@id='field_frmnew10']//select[@id='show_on_detail']"))->selectOptionByLabel('Yes'); |
|
37 | - $this->byXPath("//div[@id='field_frmnew10']//input[@id='cat_sort']")->click(); |
|
38 | - $this->byXPath("//div[@id='field_frmnew10']//input[@id='cat_filter']")->click(); |
|
39 | - $this->byXPath("//div[@id='field_frmnew10']//input[@id='save']")->click(); |
|
40 | - $this->waitForPageLoadAndCheckForErrors(); |
|
17 | + public function testAddCustomFields() |
|
18 | + { |
|
19 | + $this->logInfo('Add custom fields......'); |
|
20 | + $this->prepareSession()->currentWindow()->maximize(); |
|
21 | + //Field 1 |
|
22 | + $this->maybeAdminLogin(self::GDTEST_BASE_URL.'wp-admin/admin.php?page=geodirectory&tab=gd_place_fields_settings&subtab=custom_fields&listing_type=gd_place'); |
|
23 | + $this->waitForPageLoadAndCheckForErrors(); |
|
24 | + $this->byId('gt-text')->click(); |
|
25 | + $this->waitForPageLoadAndCheckForErrors(); |
|
26 | + $link = $this->byXPath("//li[@id='licontainer_new10']/div[contains(@class,'titlenew10')]"); |
|
27 | + $this->moveto($link); |
|
28 | + $this->doubleclick(); |
|
29 | + $this->waitForPageLoadAndCheckForErrors(); |
|
30 | + $this->byXPath("//div[@id='field_frmnew10']//input[@id='admin_title']")->value('Text Field 1'); |
|
31 | + $this->byXPath("//div[@id='field_frmnew10']//input[@id='site_title']")->value('Text Field 1'); |
|
32 | + $this->byXPath("//div[@id='field_frmnew10']//input[@id='htmlvar_name']")->value('text_field_1'); |
|
33 | + $this->byXPath("//div[@id='field_frmnew10']//input[@id='clabels']")->value('Text Field 1'); |
|
34 | + $this->select($this->byXPath("//div[@id='field_frmnew10']//select[@id='is_active']"))->selectOptionByLabel('Yes'); |
|
35 | + $this->select($this->byXPath("//div[@id='field_frmnew10']//select[@id='show_on_listing']"))->selectOptionByLabel('Yes'); |
|
36 | + $this->select($this->byXPath("//div[@id='field_frmnew10']//select[@id='show_on_detail']"))->selectOptionByLabel('Yes'); |
|
37 | + $this->byXPath("//div[@id='field_frmnew10']//input[@id='cat_sort']")->click(); |
|
38 | + $this->byXPath("//div[@id='field_frmnew10']//input[@id='cat_filter']")->click(); |
|
39 | + $this->byXPath("//div[@id='field_frmnew10']//input[@id='save']")->click(); |
|
40 | + $this->waitForPageLoadAndCheckForErrors(); |
|
41 | 41 | |
42 | - //Field 2 |
|
43 | - $this->maybeAdminLogin(self::GDTEST_BASE_URL.'wp-admin/admin.php?page=geodirectory&tab=gd_place_fields_settings&subtab=custom_fields&listing_type=gd_place'); |
|
44 | - $this->waitForPageLoadAndCheckForErrors(); |
|
45 | - $this->byId('gt-text')->click(); |
|
46 | - $this->waitForPageLoadAndCheckForErrors(); |
|
47 | - $link = $this->byXPath("//li[@id='licontainer_new11']/div[contains(@class,'titlenew11')]"); |
|
48 | - $this->moveto($link); |
|
49 | - $this->doubleclick(); |
|
50 | - $this->waitForPageLoadAndCheckForErrors(); |
|
51 | - $this->byXPath("//div[@id='field_frmnew11']//input[@id='admin_title']")->value('Text Field 2'); |
|
52 | - $this->byXPath("//div[@id='field_frmnew11']//input[@id='site_title']")->value('Text Field 2'); |
|
53 | - $this->byXPath("//div[@id='field_frmnew11']//input[@id='htmlvar_name']")->value('text_field_2'); |
|
54 | - $this->byXPath("//div[@id='field_frmnew11']//input[@id='clabels']")->value('Text Field 2'); |
|
55 | - $this->select($this->byXPath("//div[@id='field_frmnew11']//select[@id='is_active']"))->selectOptionByLabel('Yes'); |
|
56 | - $this->select($this->byXPath("//div[@id='field_frmnew11']//select[@id='show_on_listing']"))->selectOptionByLabel('Yes'); |
|
57 | - $this->select($this->byXPath("//div[@id='field_frmnew11']//select[@id='show_on_detail']"))->selectOptionByLabel('Yes'); |
|
58 | - $this->byXPath("//div[@id='field_frmnew11']//input[@id='cat_sort']")->click(); |
|
59 | - $this->byXPath("//div[@id='field_frmnew11']//input[@id='cat_filter']")->click(); |
|
60 | - $this->byXPath("//div[@id='field_frmnew11']//input[@id='save']")->click(); |
|
61 | - $this->waitForPageLoadAndCheckForErrors(); |
|
62 | - } |
|
42 | + //Field 2 |
|
43 | + $this->maybeAdminLogin(self::GDTEST_BASE_URL.'wp-admin/admin.php?page=geodirectory&tab=gd_place_fields_settings&subtab=custom_fields&listing_type=gd_place'); |
|
44 | + $this->waitForPageLoadAndCheckForErrors(); |
|
45 | + $this->byId('gt-text')->click(); |
|
46 | + $this->waitForPageLoadAndCheckForErrors(); |
|
47 | + $link = $this->byXPath("//li[@id='licontainer_new11']/div[contains(@class,'titlenew11')]"); |
|
48 | + $this->moveto($link); |
|
49 | + $this->doubleclick(); |
|
50 | + $this->waitForPageLoadAndCheckForErrors(); |
|
51 | + $this->byXPath("//div[@id='field_frmnew11']//input[@id='admin_title']")->value('Text Field 2'); |
|
52 | + $this->byXPath("//div[@id='field_frmnew11']//input[@id='site_title']")->value('Text Field 2'); |
|
53 | + $this->byXPath("//div[@id='field_frmnew11']//input[@id='htmlvar_name']")->value('text_field_2'); |
|
54 | + $this->byXPath("//div[@id='field_frmnew11']//input[@id='clabels']")->value('Text Field 2'); |
|
55 | + $this->select($this->byXPath("//div[@id='field_frmnew11']//select[@id='is_active']"))->selectOptionByLabel('Yes'); |
|
56 | + $this->select($this->byXPath("//div[@id='field_frmnew11']//select[@id='show_on_listing']"))->selectOptionByLabel('Yes'); |
|
57 | + $this->select($this->byXPath("//div[@id='field_frmnew11']//select[@id='show_on_detail']"))->selectOptionByLabel('Yes'); |
|
58 | + $this->byXPath("//div[@id='field_frmnew11']//input[@id='cat_sort']")->click(); |
|
59 | + $this->byXPath("//div[@id='field_frmnew11']//input[@id='cat_filter']")->click(); |
|
60 | + $this->byXPath("//div[@id='field_frmnew11']//input[@id='save']")->click(); |
|
61 | + $this->waitForPageLoadAndCheckForErrors(); |
|
62 | + } |
|
63 | 63 | |
64 | - public function tearDown() |
|
65 | - { |
|
66 | - if (!$this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
67 | - //write current file number to completed.txt |
|
68 | - $CurrentFileNumber = $this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)); |
|
69 | - $completed = fopen("tests/selenium/completed.txt", "w") or die("Unable to open file!"); |
|
70 | - fwrite($completed, $CurrentFileNumber); |
|
71 | - } |
|
72 | - } |
|
64 | + public function tearDown() |
|
65 | + { |
|
66 | + if (!$this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
67 | + //write current file number to completed.txt |
|
68 | + $CurrentFileNumber = $this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)); |
|
69 | + $completed = fopen("tests/selenium/completed.txt", "w") or die("Unable to open file!"); |
|
70 | + fwrite($completed, $CurrentFileNumber); |
|
71 | + } |
|
72 | + } |
|
73 | 73 | } |
74 | 74 | ?> |
75 | 75 | \ No newline at end of file |
@@ -1,48 +1,48 @@ |
||
1 | 1 | <?php |
2 | 2 | class AddReview extends GD_Test |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | 7 | |
8 | - //skip test if already completed. |
|
9 | - if ($this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
10 | - $this->markTestSkipped('Skipping '.pathinfo(__FILE__, PATHINFO_FILENAME).' since its already completed......'); |
|
11 | - return; |
|
12 | - } else { |
|
13 | - $this->prepareSession()->currentWindow()->maximize(); |
|
14 | - } |
|
15 | - } |
|
8 | + //skip test if already completed. |
|
9 | + if ($this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
10 | + $this->markTestSkipped('Skipping '.pathinfo(__FILE__, PATHINFO_FILENAME).' since its already completed......'); |
|
11 | + return; |
|
12 | + } else { |
|
13 | + $this->prepareSession()->currentWindow()->maximize(); |
|
14 | + } |
|
15 | + } |
|
16 | 16 | |
17 | - public function testAddReview() |
|
18 | - { |
|
19 | - $this->logInfo('Adding a review......'); |
|
20 | - $this->maybeUserLogin(self::GDTEST_BASE_URL.'places/united-states/new-york/new-york/attractions/franklin-square/', true); |
|
21 | - $this->waitForPageLoadAndCheckForErrors(); |
|
22 | - $this->prepareSession()->currentWindow()->maximize(); |
|
23 | - $this->ExecuteScript('jQuery(".geodir-tab-head").css("overflow", "hidden");'); |
|
24 | - try { |
|
25 | - $this->byXPath("//a[text()='Reviews']")->click(); |
|
26 | - } catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) { |
|
27 | - if (PHPUnit_Extensions_Selenium2TestCase_WebDriverException::ElementNotVisible == $e->getCode()) { |
|
28 | - $this->ExecuteScript('jQuery("#geodir-tab-mobile-menu").click();'); |
|
29 | - $this->byXPath("//a[text()='Reviews']")->click(); |
|
30 | - } |
|
31 | - } |
|
32 | - $this->ExecuteScript('jQuery("#geodir_overallrating").val("4");'); |
|
33 | - $this->byId('comment')->value('Cool xyz'); |
|
34 | - $this->byId('submit')->click(); |
|
35 | - $this->waitForPageLoadAndCheckForErrors(); |
|
36 | - } |
|
17 | + public function testAddReview() |
|
18 | + { |
|
19 | + $this->logInfo('Adding a review......'); |
|
20 | + $this->maybeUserLogin(self::GDTEST_BASE_URL.'places/united-states/new-york/new-york/attractions/franklin-square/', true); |
|
21 | + $this->waitForPageLoadAndCheckForErrors(); |
|
22 | + $this->prepareSession()->currentWindow()->maximize(); |
|
23 | + $this->ExecuteScript('jQuery(".geodir-tab-head").css("overflow", "hidden");'); |
|
24 | + try { |
|
25 | + $this->byXPath("//a[text()='Reviews']")->click(); |
|
26 | + } catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) { |
|
27 | + if (PHPUnit_Extensions_Selenium2TestCase_WebDriverException::ElementNotVisible == $e->getCode()) { |
|
28 | + $this->ExecuteScript('jQuery("#geodir-tab-mobile-menu").click();'); |
|
29 | + $this->byXPath("//a[text()='Reviews']")->click(); |
|
30 | + } |
|
31 | + } |
|
32 | + $this->ExecuteScript('jQuery("#geodir_overallrating").val("4");'); |
|
33 | + $this->byId('comment')->value('Cool xyz'); |
|
34 | + $this->byId('submit')->click(); |
|
35 | + $this->waitForPageLoadAndCheckForErrors(); |
|
36 | + } |
|
37 | 37 | |
38 | - public function tearDown() |
|
39 | - { |
|
40 | - if (!$this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
41 | - //write current file number to completed.txt |
|
42 | - $CurrentFileNumber = $this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)); |
|
43 | - $completed = fopen("tests/selenium/completed.txt", "w") or die("Unable to open file!"); |
|
44 | - fwrite($completed, $CurrentFileNumber); |
|
45 | - } |
|
46 | - } |
|
38 | + public function tearDown() |
|
39 | + { |
|
40 | + if (!$this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
41 | + //write current file number to completed.txt |
|
42 | + $CurrentFileNumber = $this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)); |
|
43 | + $completed = fopen("tests/selenium/completed.txt", "w") or die("Unable to open file!"); |
|
44 | + fwrite($completed, $CurrentFileNumber); |
|
45 | + } |
|
46 | + } |
|
47 | 47 | } |
48 | 48 | ?> |
49 | 49 | \ No newline at end of file |
@@ -1,50 +1,50 @@ |
||
1 | 1 | <?php |
2 | 2 | class GDBooster extends GD_Test |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - |
|
8 | - //skip test if already completed. |
|
9 | - if ($this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
10 | - $this->markTestSkipped('Skipping '.pathinfo(__FILE__, PATHINFO_FILENAME).' since its already completed......'); |
|
11 | - return; |
|
12 | - } else { |
|
13 | - $this->prepareSession()->currentWindow()->maximize(); |
|
14 | - } |
|
15 | - } |
|
16 | - |
|
17 | - public function testGDBooster() |
|
18 | - { |
|
19 | - $this->logInfo('Testing GD booster......'); |
|
20 | - |
|
21 | - //make sure GD Booster plugin active |
|
22 | - $this->maybeAdminLogin(self::GDTEST_BASE_URL.'wp-admin/plugins.php'); |
|
23 | - $this->waitForPageLoadAndCheckForErrors(); |
|
24 | - |
|
25 | - $is_active = $this->byId("gd-booster")->attribute('class'); |
|
26 | - if (is_int(strpos($is_active, 'inactive'))) { |
|
27 | - //Activate Geodirectory Booster |
|
28 | - $this->maybeActivatePlugin("gd-booster", 20000); |
|
29 | - //go back to plugin page |
|
30 | - $this->url(self::GDTEST_BASE_URL.'wp-admin/plugins.php'); |
|
31 | - } |
|
32 | - |
|
33 | - $is_active1 = $this->byId("gd-booster")->attribute('class'); |
|
34 | - $this->assertFalse( strpos($is_active1, 'inactive'), "GD Booster plugin not active"); |
|
35 | - |
|
36 | - |
|
37 | - |
|
38 | - } |
|
39 | - |
|
40 | - public function tearDown() |
|
41 | - { |
|
42 | - if (!$this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
43 | - //write current file number to completed.txt |
|
44 | - $CurrentFileNumber = $this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)); |
|
45 | - $completed = fopen("tests/selenium/completed.txt", "w") or die("Unable to open file!"); |
|
46 | - fwrite($completed, $CurrentFileNumber); |
|
47 | - } |
|
48 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + |
|
8 | + //skip test if already completed. |
|
9 | + if ($this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
10 | + $this->markTestSkipped('Skipping '.pathinfo(__FILE__, PATHINFO_FILENAME).' since its already completed......'); |
|
11 | + return; |
|
12 | + } else { |
|
13 | + $this->prepareSession()->currentWindow()->maximize(); |
|
14 | + } |
|
15 | + } |
|
16 | + |
|
17 | + public function testGDBooster() |
|
18 | + { |
|
19 | + $this->logInfo('Testing GD booster......'); |
|
20 | + |
|
21 | + //make sure GD Booster plugin active |
|
22 | + $this->maybeAdminLogin(self::GDTEST_BASE_URL.'wp-admin/plugins.php'); |
|
23 | + $this->waitForPageLoadAndCheckForErrors(); |
|
24 | + |
|
25 | + $is_active = $this->byId("gd-booster")->attribute('class'); |
|
26 | + if (is_int(strpos($is_active, 'inactive'))) { |
|
27 | + //Activate Geodirectory Booster |
|
28 | + $this->maybeActivatePlugin("gd-booster", 20000); |
|
29 | + //go back to plugin page |
|
30 | + $this->url(self::GDTEST_BASE_URL.'wp-admin/plugins.php'); |
|
31 | + } |
|
32 | + |
|
33 | + $is_active1 = $this->byId("gd-booster")->attribute('class'); |
|
34 | + $this->assertFalse( strpos($is_active1, 'inactive'), "GD Booster plugin not active"); |
|
35 | + |
|
36 | + |
|
37 | + |
|
38 | + } |
|
39 | + |
|
40 | + public function tearDown() |
|
41 | + { |
|
42 | + if (!$this->skipTest($this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)), $this->getCompletedFileNumber())) { |
|
43 | + //write current file number to completed.txt |
|
44 | + $CurrentFileNumber = $this->getCurrentFileNumber(pathinfo(__FILE__, PATHINFO_FILENAME)); |
|
45 | + $completed = fopen("tests/selenium/completed.txt", "w") or die("Unable to open file!"); |
|
46 | + fwrite($completed, $CurrentFileNumber); |
|
47 | + } |
|
48 | + } |
|
49 | 49 | } |
50 | 50 | ?> |
51 | 51 | \ No newline at end of file |
@@ -31,7 +31,7 @@ |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | $is_active1 = $this->byId("gd-booster")->attribute('class'); |
34 | - $this->assertFalse( strpos($is_active1, 'inactive'), "GD Booster plugin not active"); |
|
34 | + $this->assertFalse(strpos($is_active1, 'inactive'), "GD Booster plugin not active"); |
|
35 | 35 | |
36 | 36 | |
37 | 37 |