@@ -1,309 +1,309 @@ |
||
1 | 1 | <?php |
2 | 2 | class AddCustomFields 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 testAddCustomFields() |
|
11 | - { |
|
12 | - $field = array( |
|
13 | - 'listing_type' => 'gd_place', |
|
14 | - 'data_type' => '', |
|
15 | - 'field_type' => 'select', |
|
16 | - 'admin_title' => __( 'Place Type', 'test' ), |
|
17 | - 'admin_desc' => __( 'Select the place type.', 'test' ), |
|
18 | - 'site_title' => __( 'Place Type', 'test' ), |
|
19 | - 'htmlvar_name' => 'test_place_type', |
|
20 | - 'default_value' => '', |
|
21 | - 'option_values' => 'Hotel,Bar,Restaurant,Pub', |
|
22 | - 'is_default' => '1', |
|
23 | - 'is_admin' => '1', |
|
24 | - 'clabels' => __( 'Place Type', 'test' ) |
|
25 | - ); |
|
10 | + public function testAddCustomFields() |
|
11 | + { |
|
12 | + $field = array( |
|
13 | + 'listing_type' => 'gd_place', |
|
14 | + 'data_type' => '', |
|
15 | + 'field_type' => 'select', |
|
16 | + 'admin_title' => __( 'Place Type', 'test' ), |
|
17 | + 'admin_desc' => __( 'Select the place type.', 'test' ), |
|
18 | + 'site_title' => __( 'Place Type', 'test' ), |
|
19 | + 'htmlvar_name' => 'test_place_type', |
|
20 | + 'default_value' => '', |
|
21 | + 'option_values' => 'Hotel,Bar,Restaurant,Pub', |
|
22 | + 'is_default' => '1', |
|
23 | + 'is_admin' => '1', |
|
24 | + 'clabels' => __( 'Place Type', 'test' ) |
|
25 | + ); |
|
26 | 26 | |
27 | - $lastid = geodir_custom_field_save( $field ); |
|
27 | + $lastid = geodir_custom_field_save( $field ); |
|
28 | 28 | |
29 | - $this->assertTrue(is_int($lastid)); |
|
29 | + $this->assertTrue(is_int($lastid)); |
|
30 | 30 | |
31 | 31 | |
32 | - $field2 = array( |
|
33 | - 'listing_type' => 'gd_place', |
|
34 | - 'data_type' => 'VARCHAR', |
|
35 | - 'field_type' => 'url', |
|
36 | - 'admin_title' => __( 'Website Link', 'test' ), |
|
37 | - 'admin_desc' => __( 'Enter the website link.', 'test' ), |
|
38 | - 'site_title' => __( 'Website Link', 'test' ), |
|
39 | - 'htmlvar_name' => 'test_ws_link', |
|
40 | - 'default_value' => '', |
|
41 | - 'option_values' => '', |
|
42 | - 'is_default' => '1', |
|
43 | - 'is_admin' => '1', |
|
44 | - 'clabels' => __( 'Website Link', 'test' ) |
|
45 | - ); |
|
32 | + $field2 = array( |
|
33 | + 'listing_type' => 'gd_place', |
|
34 | + 'data_type' => 'VARCHAR', |
|
35 | + 'field_type' => 'url', |
|
36 | + 'admin_title' => __( 'Website Link', 'test' ), |
|
37 | + 'admin_desc' => __( 'Enter the website link.', 'test' ), |
|
38 | + 'site_title' => __( 'Website Link', 'test' ), |
|
39 | + 'htmlvar_name' => 'test_ws_link', |
|
40 | + 'default_value' => '', |
|
41 | + 'option_values' => '', |
|
42 | + 'is_default' => '1', |
|
43 | + 'is_admin' => '1', |
|
44 | + 'clabels' => __( 'Website Link', 'test' ) |
|
45 | + ); |
|
46 | 46 | |
47 | - $lastid2 = geodir_custom_field_save( $field2 ); |
|
47 | + $lastid2 = geodir_custom_field_save( $field2 ); |
|
48 | 48 | |
49 | - $this->assertTrue(is_int($lastid2)); |
|
49 | + $this->assertTrue(is_int($lastid2)); |
|
50 | 50 | |
51 | - //test error |
|
52 | - $field3 = array( |
|
53 | - 'listing_type' => 'gd_place', |
|
54 | - 'data_type' => '', |
|
55 | - 'field_type' => 'select', |
|
56 | - 'admin_title' => __( 'Place Type', 'test' ), |
|
57 | - 'admin_desc' => __( 'Select the place type.', 'test' ), |
|
58 | - 'site_title' => __( 'Place Type', 'test' ), |
|
59 | - 'htmlvar_name' => 'test_place_type', |
|
60 | - 'default_value' => '', |
|
61 | - 'option_values' => 'Hotel,Bar,Restaurant,Pub', |
|
62 | - 'is_default' => '1', |
|
63 | - 'is_admin' => '1', |
|
64 | - 'clabels' => __( 'Place Type', 'test' ) |
|
65 | - ); |
|
51 | + //test error |
|
52 | + $field3 = array( |
|
53 | + 'listing_type' => 'gd_place', |
|
54 | + 'data_type' => '', |
|
55 | + 'field_type' => 'select', |
|
56 | + 'admin_title' => __( 'Place Type', 'test' ), |
|
57 | + 'admin_desc' => __( 'Select the place type.', 'test' ), |
|
58 | + 'site_title' => __( 'Place Type', 'test' ), |
|
59 | + 'htmlvar_name' => 'test_place_type', |
|
60 | + 'default_value' => '', |
|
61 | + 'option_values' => 'Hotel,Bar,Restaurant,Pub', |
|
62 | + 'is_default' => '1', |
|
63 | + 'is_admin' => '1', |
|
64 | + 'clabels' => __( 'Place Type', 'test' ) |
|
65 | + ); |
|
66 | 66 | |
67 | - $error = geodir_custom_field_save( $field3 ); |
|
67 | + $error = geodir_custom_field_save( $field3 ); |
|
68 | 68 | |
69 | - $this->assertContains( 'HTML Variable Name should be a unique name', $error ); |
|
70 | - } |
|
69 | + $this->assertContains( 'HTML Variable Name should be a unique name', $error ); |
|
70 | + } |
|
71 | 71 | |
72 | - public function testAddMoreCustomFields() { |
|
73 | - $fieldsets = array(); |
|
74 | - $fields = array(); |
|
75 | - $filters = array(); |
|
72 | + public function testAddMoreCustomFields() { |
|
73 | + $fieldsets = array(); |
|
74 | + $fields = array(); |
|
75 | + $filters = array(); |
|
76 | 76 | |
77 | - // Place Details |
|
78 | - $fieldsets[] = array( |
|
79 | - 'listing_type' => 'gd_place', |
|
80 | - 'data_type' => '', |
|
81 | - 'field_type' => 'fieldset', |
|
82 | - 'admin_title' => __( 'Place Details', 'directory_starter' ), |
|
83 | - 'admin_desc' => __( 'Place Details.', 'directory_starter' ), |
|
84 | - 'site_title' => __( 'Place Details', 'directory_starter' ), |
|
85 | - 'default_value' => '', |
|
86 | - 'option_values' => '', |
|
87 | - 'is_default' => '1', |
|
88 | - 'is_admin' => '1', |
|
89 | - 'clabels' => __( 'Place Details', 'directory_starter' ) |
|
90 | - ); |
|
77 | + // Place Details |
|
78 | + $fieldsets[] = array( |
|
79 | + 'listing_type' => 'gd_place', |
|
80 | + 'data_type' => '', |
|
81 | + 'field_type' => 'fieldset', |
|
82 | + 'admin_title' => __( 'Place Details', 'directory_starter' ), |
|
83 | + 'admin_desc' => __( 'Place Details.', 'directory_starter' ), |
|
84 | + 'site_title' => __( 'Place Details', 'directory_starter' ), |
|
85 | + 'default_value' => '', |
|
86 | + 'option_values' => '', |
|
87 | + 'is_default' => '1', |
|
88 | + 'is_admin' => '1', |
|
89 | + 'clabels' => __( 'Place Details', 'directory_starter' ) |
|
90 | + ); |
|
91 | 91 | |
92 | - // Salary |
|
93 | - $fields[] = array( |
|
94 | - 'listing_type' => 'gd_place', |
|
95 | - 'data_type' => 'INT', |
|
96 | - 'field_type' => 'text', |
|
97 | - 'admin_title' => __('Salary', 'directory_starter'), |
|
98 | - 'admin_desc' => __('Enter salary.', 'directory_starter'), |
|
99 | - 'site_title' => __('Salary', 'directory_starter'), |
|
100 | - 'htmlvar_name' => 'job_salary', |
|
101 | - 'default_value' => '', |
|
102 | - 'option_values' => '', |
|
103 | - 'is_default' => '1', |
|
104 | - 'is_admin' => '1', |
|
105 | - 'clabels' => __('Salary', 'directory_starter') |
|
106 | - ); |
|
92 | + // Salary |
|
93 | + $fields[] = array( |
|
94 | + 'listing_type' => 'gd_place', |
|
95 | + 'data_type' => 'INT', |
|
96 | + 'field_type' => 'text', |
|
97 | + 'admin_title' => __('Salary', 'directory_starter'), |
|
98 | + 'admin_desc' => __('Enter salary.', 'directory_starter'), |
|
99 | + 'site_title' => __('Salary', 'directory_starter'), |
|
100 | + 'htmlvar_name' => 'job_salary', |
|
101 | + 'default_value' => '', |
|
102 | + 'option_values' => '', |
|
103 | + 'is_default' => '1', |
|
104 | + 'is_admin' => '1', |
|
105 | + 'clabels' => __('Salary', 'directory_starter') |
|
106 | + ); |
|
107 | 107 | |
108 | - // Salary Filter |
|
109 | - $filters[] = array( |
|
110 | - 'create_field' => 'true', |
|
111 | - 'listing_type' => 'gd_place', |
|
112 | - 'field_id' => '', |
|
113 | - 'field_type' => 'text', |
|
114 | - 'data_type' => 'RANGE', |
|
115 | - 'is_active' => '1', |
|
116 | - 'site_field_title' => 'Salary', |
|
117 | - 'field_data_type' => 'INT', |
|
118 | - 'data_type_change' => 'TEXT', |
|
119 | - 'search_condition_select' => 'FROM', |
|
120 | - 'search_min_value' => '', |
|
121 | - 'search_max_value' => '', |
|
122 | - 'search_diff_value' => '', |
|
123 | - 'first_search_value' => '', |
|
124 | - 'first_search_text' => '', |
|
125 | - 'last_search_text' => '', |
|
126 | - 'search_condition' => 'FROM', |
|
127 | - 'site_htmlvar_name' => 'geodir_job_salary', |
|
128 | - 'field_title' => 'geodir_job_salary', |
|
129 | - 'expand_custom_value' => '', |
|
130 | - 'front_search_title' => 'Salary', |
|
131 | - 'field_desc' => '' |
|
132 | - ); |
|
108 | + // Salary Filter |
|
109 | + $filters[] = array( |
|
110 | + 'create_field' => 'true', |
|
111 | + 'listing_type' => 'gd_place', |
|
112 | + 'field_id' => '', |
|
113 | + 'field_type' => 'text', |
|
114 | + 'data_type' => 'RANGE', |
|
115 | + 'is_active' => '1', |
|
116 | + 'site_field_title' => 'Salary', |
|
117 | + 'field_data_type' => 'INT', |
|
118 | + 'data_type_change' => 'TEXT', |
|
119 | + 'search_condition_select' => 'FROM', |
|
120 | + 'search_min_value' => '', |
|
121 | + 'search_max_value' => '', |
|
122 | + 'search_diff_value' => '', |
|
123 | + 'first_search_value' => '', |
|
124 | + 'first_search_text' => '', |
|
125 | + 'last_search_text' => '', |
|
126 | + 'search_condition' => 'FROM', |
|
127 | + 'site_htmlvar_name' => 'geodir_job_salary', |
|
128 | + 'field_title' => 'geodir_job_salary', |
|
129 | + 'expand_custom_value' => '', |
|
130 | + 'front_search_title' => 'Salary', |
|
131 | + 'field_desc' => '' |
|
132 | + ); |
|
133 | 133 | |
134 | - // Field Set |
|
135 | - if (!empty($fieldsets)) { |
|
136 | - foreach ($fieldsets as $fieldset_index => $fieldset) { |
|
137 | - geodir_custom_field_save($fieldset); |
|
138 | - } |
|
139 | - } |
|
134 | + // Field Set |
|
135 | + if (!empty($fieldsets)) { |
|
136 | + foreach ($fieldsets as $fieldset_index => $fieldset) { |
|
137 | + geodir_custom_field_save($fieldset); |
|
138 | + } |
|
139 | + } |
|
140 | 140 | |
141 | - // Custom Fields |
|
142 | - if (!empty($fields)) { |
|
143 | - foreach ($fields as $field_index => $field) { |
|
144 | - $lastid = geodir_custom_field_save( $field ); |
|
145 | - $this->assertTrue(is_int($lastid)); |
|
146 | - } |
|
147 | - } |
|
141 | + // Custom Fields |
|
142 | + if (!empty($fields)) { |
|
143 | + foreach ($fields as $field_index => $field) { |
|
144 | + $lastid = geodir_custom_field_save( $field ); |
|
145 | + $this->assertTrue(is_int($lastid)); |
|
146 | + } |
|
147 | + } |
|
148 | 148 | |
149 | - } |
|
149 | + } |
|
150 | 150 | |
151 | - public function testTextCusField() { |
|
152 | - $_REQUEST = array ( |
|
153 | - 'action' => 'geodir_ajax_action', |
|
154 | - 'create_field' => 'true', |
|
155 | - 'field_ins_upd' => 'submit', |
|
156 | - '_wpnonce' => wp_create_nonce('custom_fields_text_field_99'), |
|
157 | - 'listing_type' => 'gd_place', |
|
158 | - 'field_type' => 'text', |
|
159 | - 'field_id' => 'text_field_99', |
|
160 | - 'data_type' => 'XVARCHAR', |
|
161 | - 'is_active' => '1', |
|
162 | - 'site_title' => "Text Field", |
|
163 | - 'admin_title' => "Text Field", |
|
164 | - 'admin_desc' => "Text Field", |
|
165 | - 'site_field_title' => 'Category', |
|
166 | - 'field_data_type' => 'VARCHAR', |
|
167 | - 'search_condition' => 'SINGLE', |
|
168 | - 'htmlvar_name' => 'text_field_99', |
|
169 | - 'for_admin_use' => '0', |
|
170 | - 'is_required' => '0', |
|
171 | - 'required_msg'=> '', |
|
172 | - 'validation_pattern' => '', |
|
173 | - 'validation_msg' => '', |
|
174 | - 'decimal_point' => '', |
|
175 | - 'clabels' => 'Text Field', |
|
176 | - 'is_default' => '1', |
|
177 | - 'field_title' => 'Text Field', |
|
178 | - 'expand_custom_value' => '', |
|
179 | - 'search_operator' => 'AND', |
|
180 | - 'front_search_title' => 'Category', |
|
181 | - 'field_desc' => 'Cat', |
|
182 | - 'geodir_ajax' => 'admin_ajax', |
|
183 | - 'manage_field_type' => 'custom_fields', |
|
184 | - 'default_value' => '' , |
|
185 | - 'sort_order' => '11' , |
|
186 | - 'show_on_listing' => '1' , |
|
187 | - 'show_on_detail' => '1' , |
|
188 | - 'show_as_tab' => '0' , |
|
189 | - 'field_icon' => '' , |
|
190 | - 'css_class' => '' , |
|
191 | - ); |
|
192 | - add_filter('wp_redirect', '__return_false'); |
|
193 | - ob_start(); |
|
194 | - geodir_ajax_handler(); |
|
195 | - $output = ob_get_contents(); |
|
196 | - ob_end_clean(); |
|
197 | - $this->assertContains('Double Click to toggle', $output); |
|
198 | - remove_filter('wp_redirect', '__return_false'); |
|
151 | + public function testTextCusField() { |
|
152 | + $_REQUEST = array ( |
|
153 | + 'action' => 'geodir_ajax_action', |
|
154 | + 'create_field' => 'true', |
|
155 | + 'field_ins_upd' => 'submit', |
|
156 | + '_wpnonce' => wp_create_nonce('custom_fields_text_field_99'), |
|
157 | + 'listing_type' => 'gd_place', |
|
158 | + 'field_type' => 'text', |
|
159 | + 'field_id' => 'text_field_99', |
|
160 | + 'data_type' => 'XVARCHAR', |
|
161 | + 'is_active' => '1', |
|
162 | + 'site_title' => "Text Field", |
|
163 | + 'admin_title' => "Text Field", |
|
164 | + 'admin_desc' => "Text Field", |
|
165 | + 'site_field_title' => 'Category', |
|
166 | + 'field_data_type' => 'VARCHAR', |
|
167 | + 'search_condition' => 'SINGLE', |
|
168 | + 'htmlvar_name' => 'text_field_99', |
|
169 | + 'for_admin_use' => '0', |
|
170 | + 'is_required' => '0', |
|
171 | + 'required_msg'=> '', |
|
172 | + 'validation_pattern' => '', |
|
173 | + 'validation_msg' => '', |
|
174 | + 'decimal_point' => '', |
|
175 | + 'clabels' => 'Text Field', |
|
176 | + 'is_default' => '1', |
|
177 | + 'field_title' => 'Text Field', |
|
178 | + 'expand_custom_value' => '', |
|
179 | + 'search_operator' => 'AND', |
|
180 | + 'front_search_title' => 'Category', |
|
181 | + 'field_desc' => 'Cat', |
|
182 | + 'geodir_ajax' => 'admin_ajax', |
|
183 | + 'manage_field_type' => 'custom_fields', |
|
184 | + 'default_value' => '' , |
|
185 | + 'sort_order' => '11' , |
|
186 | + 'show_on_listing' => '1' , |
|
187 | + 'show_on_detail' => '1' , |
|
188 | + 'show_as_tab' => '0' , |
|
189 | + 'field_icon' => '' , |
|
190 | + 'css_class' => '' , |
|
191 | + ); |
|
192 | + add_filter('wp_redirect', '__return_false'); |
|
193 | + ob_start(); |
|
194 | + geodir_ajax_handler(); |
|
195 | + $output = ob_get_contents(); |
|
196 | + ob_end_clean(); |
|
197 | + $this->assertContains('Double Click to toggle', $output); |
|
198 | + remove_filter('wp_redirect', '__return_false'); |
|
199 | 199 | |
200 | - } |
|
200 | + } |
|
201 | 201 | |
202 | - public function texstDateCusField() { |
|
203 | - $_REQUEST = array ( |
|
204 | - 'action' => 'geodir_ajax_action', |
|
205 | - 'create_field' => 'true', |
|
206 | - 'field_ins_upd' => 'submit', |
|
207 | - '_wpnonce' => wp_create_nonce('custom_fields_date_field'), |
|
208 | - 'listing_type' => 'gd_place', |
|
209 | - 'field_type' => 'datepicker', |
|
210 | - 'field_id' => 'date_field', |
|
211 | - 'data_type' => '', |
|
212 | - 'is_active' => '1', |
|
213 | - 'site_title' => "Text Field", |
|
214 | - 'admin_title' => "Text Field", |
|
215 | - 'admin_desc' => "Text Field", |
|
216 | - 'site_field_title' => 'Category', |
|
217 | - 'field_data_type' => 'VARCHAR', |
|
218 | - 'search_condition' => 'SINGLE', |
|
219 | - 'htmlvar_name' => 'date_field', |
|
220 | - 'for_admin_use' => '0', |
|
221 | - 'is_required' => '0', |
|
222 | - 'required_msg'=> '', |
|
223 | - 'validation_pattern' => '', |
|
224 | - 'validation_msg' => '', |
|
225 | - 'decimal_point' => '', |
|
226 | - 'clabels' => 'Text Field', |
|
227 | - 'is_default' => '0', |
|
228 | - 'field_title' => 'Text Field', |
|
229 | - 'expand_custom_value' => '', |
|
230 | - 'search_operator' => 'AND', |
|
231 | - 'front_search_title' => 'Category', |
|
232 | - 'field_desc' => 'Cat', |
|
233 | - 'geodir_ajax' => 'admin_ajax', |
|
234 | - 'manage_field_type' => 'custom_fields', |
|
235 | - 'default_value' => '' , |
|
236 | - 'sort_order' => '12' , |
|
237 | - 'show_on_listing' => '1' , |
|
238 | - 'show_on_detail' => '1' , |
|
239 | - 'show_as_tab' => '0' , |
|
240 | - 'field_icon' => '' , |
|
241 | - 'css_class' => '' , |
|
242 | - 'extra' => array( |
|
243 | - 'date_format' => 'mm/dd/yy' |
|
244 | - ) |
|
245 | - ); |
|
246 | - add_filter('wp_redirect', '__return_false'); |
|
247 | - ob_start(); |
|
248 | - geodir_ajax_handler(); |
|
249 | - $output = ob_get_contents(); |
|
250 | - ob_end_clean(); |
|
251 | - $this->assertContains('Double Click to toggle', $output); |
|
252 | - remove_filter('wp_redirect', '__return_false'); |
|
202 | + public function texstDateCusField() { |
|
203 | + $_REQUEST = array ( |
|
204 | + 'action' => 'geodir_ajax_action', |
|
205 | + 'create_field' => 'true', |
|
206 | + 'field_ins_upd' => 'submit', |
|
207 | + '_wpnonce' => wp_create_nonce('custom_fields_date_field'), |
|
208 | + 'listing_type' => 'gd_place', |
|
209 | + 'field_type' => 'datepicker', |
|
210 | + 'field_id' => 'date_field', |
|
211 | + 'data_type' => '', |
|
212 | + 'is_active' => '1', |
|
213 | + 'site_title' => "Text Field", |
|
214 | + 'admin_title' => "Text Field", |
|
215 | + 'admin_desc' => "Text Field", |
|
216 | + 'site_field_title' => 'Category', |
|
217 | + 'field_data_type' => 'VARCHAR', |
|
218 | + 'search_condition' => 'SINGLE', |
|
219 | + 'htmlvar_name' => 'date_field', |
|
220 | + 'for_admin_use' => '0', |
|
221 | + 'is_required' => '0', |
|
222 | + 'required_msg'=> '', |
|
223 | + 'validation_pattern' => '', |
|
224 | + 'validation_msg' => '', |
|
225 | + 'decimal_point' => '', |
|
226 | + 'clabels' => 'Text Field', |
|
227 | + 'is_default' => '0', |
|
228 | + 'field_title' => 'Text Field', |
|
229 | + 'expand_custom_value' => '', |
|
230 | + 'search_operator' => 'AND', |
|
231 | + 'front_search_title' => 'Category', |
|
232 | + 'field_desc' => 'Cat', |
|
233 | + 'geodir_ajax' => 'admin_ajax', |
|
234 | + 'manage_field_type' => 'custom_fields', |
|
235 | + 'default_value' => '' , |
|
236 | + 'sort_order' => '12' , |
|
237 | + 'show_on_listing' => '1' , |
|
238 | + 'show_on_detail' => '1' , |
|
239 | + 'show_as_tab' => '0' , |
|
240 | + 'field_icon' => '' , |
|
241 | + 'css_class' => '' , |
|
242 | + 'extra' => array( |
|
243 | + 'date_format' => 'mm/dd/yy' |
|
244 | + ) |
|
245 | + ); |
|
246 | + add_filter('wp_redirect', '__return_false'); |
|
247 | + ob_start(); |
|
248 | + geodir_ajax_handler(); |
|
249 | + $output = ob_get_contents(); |
|
250 | + ob_end_clean(); |
|
251 | + $this->assertContains('Double Click to toggle', $output); |
|
252 | + remove_filter('wp_redirect', '__return_false'); |
|
253 | 253 | |
254 | - } |
|
254 | + } |
|
255 | 255 | |
256 | - public function texstTextAreaCusField() { |
|
257 | - $_REQUEST = array ( |
|
258 | - 'action' => 'geodir_ajax_action', |
|
259 | - 'create_field' => 'true', |
|
260 | - 'field_ins_upd' => 'submit', |
|
261 | - '_wpnonce' => wp_create_nonce('custom_fields_textarea_field'), |
|
262 | - 'listing_type' => 'gd_place', |
|
263 | - 'field_type' => 'textarea', |
|
264 | - 'field_id' => 'textarea_field', |
|
265 | - 'data_type' => '', |
|
266 | - 'is_active' => '1', |
|
267 | - 'site_title' => "Text Field", |
|
268 | - 'admin_title' => "Text Field", |
|
269 | - 'admin_desc' => "Text Field", |
|
270 | - 'htmlvar_name' => 'textarea_field', |
|
271 | - 'for_admin_use' => '0', |
|
272 | - 'is_required' => '0', |
|
273 | - 'required_msg'=> '', |
|
274 | - 'validation_pattern' => '', |
|
275 | - 'validation_msg' => '', |
|
276 | - 'decimal_point' => '', |
|
277 | - 'clabels' => 'Text Field', |
|
278 | - 'is_default' => '1', |
|
279 | - 'field_title' => 'Text Field', |
|
280 | - 'expand_custom_value' => '', |
|
281 | - 'search_operator' => 'AND', |
|
282 | - 'front_search_title' => 'Category', |
|
283 | - 'field_desc' => 'Cat', |
|
284 | - 'geodir_ajax' => 'admin_ajax', |
|
285 | - 'manage_field_type' => 'custom_fields', |
|
286 | - 'default_value' => '' , |
|
287 | - 'sort_order' => '12' , |
|
288 | - 'show_on_listing' => '1' , |
|
289 | - 'show_on_detail' => '1' , |
|
290 | - 'show_as_tab' => '0' , |
|
291 | - 'field_icon' => '' , |
|
292 | - 'css_class' => '' , |
|
293 | - ); |
|
294 | - add_filter('wp_redirect', '__return_false'); |
|
295 | - ob_start(); |
|
296 | - geodir_ajax_handler(); |
|
297 | - $output = ob_get_contents(); |
|
298 | - ob_end_clean(); |
|
299 | - $this->assertContains('Double Click to toggle', $output); |
|
300 | - remove_filter('wp_redirect', '__return_false'); |
|
256 | + public function texstTextAreaCusField() { |
|
257 | + $_REQUEST = array ( |
|
258 | + 'action' => 'geodir_ajax_action', |
|
259 | + 'create_field' => 'true', |
|
260 | + 'field_ins_upd' => 'submit', |
|
261 | + '_wpnonce' => wp_create_nonce('custom_fields_textarea_field'), |
|
262 | + 'listing_type' => 'gd_place', |
|
263 | + 'field_type' => 'textarea', |
|
264 | + 'field_id' => 'textarea_field', |
|
265 | + 'data_type' => '', |
|
266 | + 'is_active' => '1', |
|
267 | + 'site_title' => "Text Field", |
|
268 | + 'admin_title' => "Text Field", |
|
269 | + 'admin_desc' => "Text Field", |
|
270 | + 'htmlvar_name' => 'textarea_field', |
|
271 | + 'for_admin_use' => '0', |
|
272 | + 'is_required' => '0', |
|
273 | + 'required_msg'=> '', |
|
274 | + 'validation_pattern' => '', |
|
275 | + 'validation_msg' => '', |
|
276 | + 'decimal_point' => '', |
|
277 | + 'clabels' => 'Text Field', |
|
278 | + 'is_default' => '1', |
|
279 | + 'field_title' => 'Text Field', |
|
280 | + 'expand_custom_value' => '', |
|
281 | + 'search_operator' => 'AND', |
|
282 | + 'front_search_title' => 'Category', |
|
283 | + 'field_desc' => 'Cat', |
|
284 | + 'geodir_ajax' => 'admin_ajax', |
|
285 | + 'manage_field_type' => 'custom_fields', |
|
286 | + 'default_value' => '' , |
|
287 | + 'sort_order' => '12' , |
|
288 | + 'show_on_listing' => '1' , |
|
289 | + 'show_on_detail' => '1' , |
|
290 | + 'show_as_tab' => '0' , |
|
291 | + 'field_icon' => '' , |
|
292 | + 'css_class' => '' , |
|
293 | + ); |
|
294 | + add_filter('wp_redirect', '__return_false'); |
|
295 | + ob_start(); |
|
296 | + geodir_ajax_handler(); |
|
297 | + $output = ob_get_contents(); |
|
298 | + ob_end_clean(); |
|
299 | + $this->assertContains('Double Click to toggle', $output); |
|
300 | + remove_filter('wp_redirect', '__return_false'); |
|
301 | 301 | |
302 | - } |
|
302 | + } |
|
303 | 303 | |
304 | - public function tearDown() |
|
305 | - { |
|
306 | - parent::tearDown(); |
|
307 | - } |
|
304 | + public function tearDown() |
|
305 | + { |
|
306 | + parent::tearDown(); |
|
307 | + } |
|
308 | 308 | } |
309 | 309 | ?> |
310 | 310 | \ No newline at end of file |
@@ -13,18 +13,18 @@ discard block |
||
13 | 13 | 'listing_type' => 'gd_place', |
14 | 14 | 'data_type' => '', |
15 | 15 | 'field_type' => 'select', |
16 | - 'admin_title' => __( 'Place Type', 'test' ), |
|
17 | - 'admin_desc' => __( 'Select the place type.', 'test' ), |
|
18 | - 'site_title' => __( 'Place Type', 'test' ), |
|
16 | + 'admin_title' => __('Place Type', 'test'), |
|
17 | + 'admin_desc' => __('Select the place type.', 'test'), |
|
18 | + 'site_title' => __('Place Type', 'test'), |
|
19 | 19 | 'htmlvar_name' => 'test_place_type', |
20 | 20 | 'default_value' => '', |
21 | 21 | 'option_values' => 'Hotel,Bar,Restaurant,Pub', |
22 | 22 | 'is_default' => '1', |
23 | 23 | 'is_admin' => '1', |
24 | - 'clabels' => __( 'Place Type', 'test' ) |
|
24 | + 'clabels' => __('Place Type', 'test') |
|
25 | 25 | ); |
26 | 26 | |
27 | - $lastid = geodir_custom_field_save( $field ); |
|
27 | + $lastid = geodir_custom_field_save($field); |
|
28 | 28 | |
29 | 29 | $this->assertTrue(is_int($lastid)); |
30 | 30 | |
@@ -33,18 +33,18 @@ discard block |
||
33 | 33 | 'listing_type' => 'gd_place', |
34 | 34 | 'data_type' => 'VARCHAR', |
35 | 35 | 'field_type' => 'url', |
36 | - 'admin_title' => __( 'Website Link', 'test' ), |
|
37 | - 'admin_desc' => __( 'Enter the website link.', 'test' ), |
|
38 | - 'site_title' => __( 'Website Link', 'test' ), |
|
36 | + 'admin_title' => __('Website Link', 'test'), |
|
37 | + 'admin_desc' => __('Enter the website link.', 'test'), |
|
38 | + 'site_title' => __('Website Link', 'test'), |
|
39 | 39 | 'htmlvar_name' => 'test_ws_link', |
40 | 40 | 'default_value' => '', |
41 | 41 | 'option_values' => '', |
42 | 42 | 'is_default' => '1', |
43 | 43 | 'is_admin' => '1', |
44 | - 'clabels' => __( 'Website Link', 'test' ) |
|
44 | + 'clabels' => __('Website Link', 'test') |
|
45 | 45 | ); |
46 | 46 | |
47 | - $lastid2 = geodir_custom_field_save( $field2 ); |
|
47 | + $lastid2 = geodir_custom_field_save($field2); |
|
48 | 48 | |
49 | 49 | $this->assertTrue(is_int($lastid2)); |
50 | 50 | |
@@ -53,24 +53,24 @@ discard block |
||
53 | 53 | 'listing_type' => 'gd_place', |
54 | 54 | 'data_type' => '', |
55 | 55 | 'field_type' => 'select', |
56 | - 'admin_title' => __( 'Place Type', 'test' ), |
|
57 | - 'admin_desc' => __( 'Select the place type.', 'test' ), |
|
58 | - 'site_title' => __( 'Place Type', 'test' ), |
|
56 | + 'admin_title' => __('Place Type', 'test'), |
|
57 | + 'admin_desc' => __('Select the place type.', 'test'), |
|
58 | + 'site_title' => __('Place Type', 'test'), |
|
59 | 59 | 'htmlvar_name' => 'test_place_type', |
60 | 60 | 'default_value' => '', |
61 | 61 | 'option_values' => 'Hotel,Bar,Restaurant,Pub', |
62 | 62 | 'is_default' => '1', |
63 | 63 | 'is_admin' => '1', |
64 | - 'clabels' => __( 'Place Type', 'test' ) |
|
64 | + 'clabels' => __('Place Type', 'test') |
|
65 | 65 | ); |
66 | 66 | |
67 | - $error = geodir_custom_field_save( $field3 ); |
|
67 | + $error = geodir_custom_field_save($field3); |
|
68 | 68 | |
69 | - $this->assertContains( 'HTML Variable Name should be a unique name', $error ); |
|
69 | + $this->assertContains('HTML Variable Name should be a unique name', $error); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | public function testAddMoreCustomFields() { |
73 | - $fieldsets = array(); |
|
73 | + $fieldsets = array(); |
|
74 | 74 | $fields = array(); |
75 | 75 | $filters = array(); |
76 | 76 | |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | 'listing_type' => 'gd_place', |
80 | 80 | 'data_type' => '', |
81 | 81 | 'field_type' => 'fieldset', |
82 | - 'admin_title' => __( 'Place Details', 'directory_starter' ), |
|
83 | - 'admin_desc' => __( 'Place Details.', 'directory_starter' ), |
|
84 | - 'site_title' => __( 'Place Details', 'directory_starter' ), |
|
82 | + 'admin_title' => __('Place Details', 'directory_starter'), |
|
83 | + 'admin_desc' => __('Place Details.', 'directory_starter'), |
|
84 | + 'site_title' => __('Place Details', 'directory_starter'), |
|
85 | 85 | 'default_value' => '', |
86 | 86 | 'option_values' => '', |
87 | 87 | 'is_default' => '1', |
88 | 88 | 'is_admin' => '1', |
89 | - 'clabels' => __( 'Place Details', 'directory_starter' ) |
|
89 | + 'clabels' => __('Place Details', 'directory_starter') |
|
90 | 90 | ); |
91 | 91 | |
92 | 92 | // Salary |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | // Custom Fields |
142 | 142 | if (!empty($fields)) { |
143 | 143 | foreach ($fields as $field_index => $field) { |
144 | - $lastid = geodir_custom_field_save( $field ); |
|
144 | + $lastid = geodir_custom_field_save($field); |
|
145 | 145 | $this->assertTrue(is_int($lastid)); |
146 | 146 | } |
147 | 147 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | public function testTextCusField() { |
152 | - $_REQUEST = array ( |
|
152 | + $_REQUEST = array( |
|
153 | 153 | 'action' => 'geodir_ajax_action', |
154 | 154 | 'create_field' => 'true', |
155 | 155 | 'field_ins_upd' => 'submit', |
@@ -181,13 +181,13 @@ discard block |
||
181 | 181 | 'field_desc' => 'Cat', |
182 | 182 | 'geodir_ajax' => 'admin_ajax', |
183 | 183 | 'manage_field_type' => 'custom_fields', |
184 | - 'default_value' => '' , |
|
185 | - 'sort_order' => '11' , |
|
186 | - 'show_on_listing' => '1' , |
|
187 | - 'show_on_detail' => '1' , |
|
188 | - 'show_as_tab' => '0' , |
|
189 | - 'field_icon' => '' , |
|
190 | - 'css_class' => '' , |
|
184 | + 'default_value' => '', |
|
185 | + 'sort_order' => '11', |
|
186 | + 'show_on_listing' => '1', |
|
187 | + 'show_on_detail' => '1', |
|
188 | + 'show_as_tab' => '0', |
|
189 | + 'field_icon' => '', |
|
190 | + 'css_class' => '', |
|
191 | 191 | ); |
192 | 192 | add_filter('wp_redirect', '__return_false'); |
193 | 193 | ob_start(); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | } |
201 | 201 | |
202 | 202 | public function texstDateCusField() { |
203 | - $_REQUEST = array ( |
|
203 | + $_REQUEST = array( |
|
204 | 204 | 'action' => 'geodir_ajax_action', |
205 | 205 | 'create_field' => 'true', |
206 | 206 | 'field_ins_upd' => 'submit', |
@@ -232,13 +232,13 @@ discard block |
||
232 | 232 | 'field_desc' => 'Cat', |
233 | 233 | 'geodir_ajax' => 'admin_ajax', |
234 | 234 | 'manage_field_type' => 'custom_fields', |
235 | - 'default_value' => '' , |
|
236 | - 'sort_order' => '12' , |
|
237 | - 'show_on_listing' => '1' , |
|
238 | - 'show_on_detail' => '1' , |
|
239 | - 'show_as_tab' => '0' , |
|
240 | - 'field_icon' => '' , |
|
241 | - 'css_class' => '' , |
|
235 | + 'default_value' => '', |
|
236 | + 'sort_order' => '12', |
|
237 | + 'show_on_listing' => '1', |
|
238 | + 'show_on_detail' => '1', |
|
239 | + 'show_as_tab' => '0', |
|
240 | + 'field_icon' => '', |
|
241 | + 'css_class' => '', |
|
242 | 242 | 'extra' => array( |
243 | 243 | 'date_format' => 'mm/dd/yy' |
244 | 244 | ) |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | } |
255 | 255 | |
256 | 256 | public function texstTextAreaCusField() { |
257 | - $_REQUEST = array ( |
|
257 | + $_REQUEST = array( |
|
258 | 258 | 'action' => 'geodir_ajax_action', |
259 | 259 | 'create_field' => 'true', |
260 | 260 | 'field_ins_upd' => 'submit', |
@@ -283,13 +283,13 @@ discard block |
||
283 | 283 | 'field_desc' => 'Cat', |
284 | 284 | 'geodir_ajax' => 'admin_ajax', |
285 | 285 | 'manage_field_type' => 'custom_fields', |
286 | - 'default_value' => '' , |
|
287 | - 'sort_order' => '12' , |
|
288 | - 'show_on_listing' => '1' , |
|
289 | - 'show_on_detail' => '1' , |
|
290 | - 'show_as_tab' => '0' , |
|
291 | - 'field_icon' => '' , |
|
292 | - 'css_class' => '' , |
|
286 | + 'default_value' => '', |
|
287 | + 'sort_order' => '12', |
|
288 | + 'show_on_listing' => '1', |
|
289 | + 'show_on_detail' => '1', |
|
290 | + 'show_as_tab' => '0', |
|
291 | + 'field_icon' => '', |
|
292 | + 'css_class' => '', |
|
293 | 293 | ); |
294 | 294 | add_filter('wp_redirect', '__return_false'); |
295 | 295 | ob_start(); |
@@ -3,32 +3,32 @@ discard block |
||
3 | 3 | $_SERVER['SERVER_NAME'] = ''; |
4 | 4 | $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php'; |
5 | 5 | |
6 | -define( 'GEODIR_USE_PHP_SESSIONS', false ); |
|
7 | -define( 'GD_TESTING_MODE', true ); |
|
6 | +define('GEODIR_USE_PHP_SESSIONS', false); |
|
7 | +define('GD_TESTING_MODE', true); |
|
8 | 8 | |
9 | -$_tests_dir = getenv( 'WP_TESTS_DIR' ); |
|
9 | +$_tests_dir = getenv('WP_TESTS_DIR'); |
|
10 | 10 | |
11 | -$is_selenium_test = getenv( 'IS_SELENIUM_TEST' ); |
|
11 | +$is_selenium_test = getenv('IS_SELENIUM_TEST'); |
|
12 | 12 | |
13 | -if ( ! $is_selenium_test ) { |
|
13 | +if (!$is_selenium_test) { |
|
14 | 14 | $is_selenium_test = false; |
15 | 15 | } else { |
16 | 16 | $is_selenium_test = true; |
17 | 17 | } |
18 | 18 | |
19 | -if ( ! $_tests_dir ) { |
|
20 | - $_tests_dir = dirname( __FILE__ ) . '/lib/wordpress-tests-lib'; |
|
19 | +if (!$_tests_dir) { |
|
20 | + $_tests_dir = dirname(__FILE__).'/lib/wordpress-tests-lib'; |
|
21 | 21 | } |
22 | 22 | |
23 | -require_once $_tests_dir . '/includes/functions.php'; |
|
24 | -require $_tests_dir . '/includes/bootstrap.php'; |
|
23 | +require_once $_tests_dir.'/includes/functions.php'; |
|
24 | +require $_tests_dir.'/includes/bootstrap.php'; |
|
25 | 25 | |
26 | -if ( $is_selenium_test ) { |
|
27 | - require dirname( __FILE__ ) . '/selenium/base.php'; |
|
26 | +if ($is_selenium_test) { |
|
27 | + require dirname(__FILE__).'/selenium/base.php'; |
|
28 | 28 | } |
29 | 29 | |
30 | -if ( ! $is_selenium_test ) { |
|
31 | - require dirname( __FILE__ ) . '/../geodirectory.php'; |
|
30 | +if (!$is_selenium_test) { |
|
31 | + require dirname(__FILE__).'/../geodirectory.php'; |
|
32 | 32 | tests_add_filter('place_dummy_image_url', 'place_dummy_image_url'); |
33 | 33 | tests_add_filter('place_dummy_cat_image_url', 'place_dummy_cat_image_url'); |
34 | 34 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | function test_create_dummy_posts($max = 10) { |
88 | 88 | $i = 1; |
89 | - while($i <= $max) { |
|
89 | + while ($i <= $max) { |
|
90 | 90 | global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2; |
91 | 91 | |
92 | 92 | $dummy_post_index = $i; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $city_bound_lat2 = 40.91525559999999; |
96 | 96 | $city_bound_lng2 = -73.7002721; |
97 | 97 | |
98 | - include dirname( __FILE__ ) . '/../geodirectory-admin/place_dummy_post.php'; |
|
98 | + include dirname(__FILE__).'/../geodirectory-admin/place_dummy_post.php'; |
|
99 | 99 | $i++; |
100 | 100 | } |
101 | 101 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | function place_dummy_image_url($url) { |
114 | - $gd_dummy_base_url = getenv( 'GD_DUMMY_BASE_URL' ); |
|
114 | + $gd_dummy_base_url = getenv('GD_DUMMY_BASE_URL'); |
|
115 | 115 | if ($gd_dummy_base_url) { |
116 | 116 | return $gd_dummy_base_url; |
117 | 117 | } else { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | function place_dummy_cat_image_url($url) { |
123 | - $gd_dummy_base_url = getenv( 'GD_DUMMY_BASE_URL' ); |
|
123 | + $gd_dummy_base_url = getenv('GD_DUMMY_BASE_URL'); |
|
124 | 124 | if ($gd_dummy_base_url) { |
125 | 125 | return $gd_dummy_base_url."/cat_icon"; |
126 | 126 | } else { |
@@ -1,38 +1,38 @@ |
||
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 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + wp_set_current_user(1); |
|
8 | + } |
|
9 | 9 | |
10 | - public function testDeleteListing() |
|
11 | - { |
|
12 | - $query_args = array( |
|
13 | - 'post_status' => 'publish', |
|
14 | - 'post_type' => 'gd_place', |
|
15 | - 'posts_per_page' => 1, |
|
16 | - 'author' => 1 |
|
17 | - ); |
|
10 | + public function testDeleteListing() |
|
11 | + { |
|
12 | + $query_args = array( |
|
13 | + 'post_status' => 'publish', |
|
14 | + 'post_type' => 'gd_place', |
|
15 | + 'posts_per_page' => 1, |
|
16 | + 'author' => 1 |
|
17 | + ); |
|
18 | 18 | |
19 | - $all_posts = new WP_Query( $query_args ); |
|
20 | - $post_id = null; |
|
21 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
22 | - $post_id = get_the_ID(); |
|
23 | - endwhile; |
|
19 | + $all_posts = new WP_Query( $query_args ); |
|
20 | + $post_id = null; |
|
21 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
22 | + $post_id = get_the_ID(); |
|
23 | + endwhile; |
|
24 | 24 | |
25 | - $this->assertTrue(is_int($post_id)); |
|
25 | + $this->assertTrue(is_int($post_id)); |
|
26 | 26 | |
27 | - $lastid = wp_delete_post($post_id); |
|
27 | + $lastid = wp_delete_post($post_id); |
|
28 | 28 | |
29 | - $this->assertTrue(is_int($lastid->ID)); |
|
29 | + $this->assertTrue(is_int($lastid->ID)); |
|
30 | 30 | |
31 | - } |
|
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,101 +1,101 @@ |
||
1 | 1 | <?php |
2 | 2 | class GDAjaxTests extends WP_Ajax_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - wp_set_current_user(1); |
|
8 | - } |
|
9 | - |
|
10 | - public function testBestOfWidgetAjax() { |
|
11 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
12 | - include_once($template); |
|
13 | - |
|
14 | - $time = current_time('mysql'); |
|
15 | - |
|
16 | - $query_args = array( |
|
17 | - 'post_status' => 'publish', |
|
18 | - 'post_type' => 'gd_place', |
|
19 | - 'posts_per_page' => 1, |
|
20 | - ); |
|
21 | - |
|
22 | - $all_posts = new WP_Query( $query_args ); |
|
23 | - $post_id = null; |
|
24 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
25 | - $post_id = get_the_ID(); |
|
26 | - endwhile; |
|
27 | - |
|
28 | - $this->assertTrue(is_int($post_id)); |
|
29 | - |
|
30 | - $data = array( |
|
31 | - 'comment_post_ID' => $post_id, |
|
32 | - 'comment_author' => 'admin', |
|
33 | - 'comment_author_email' => '[email protected]', |
|
34 | - 'comment_author_url' => 'http://wpgeodirectory.com', |
|
35 | - 'comment_content' => 'content here', |
|
36 | - 'comment_type' => '', |
|
37 | - 'comment_parent' => 0, |
|
38 | - 'user_id' => 1, |
|
39 | - 'comment_author_IP' => '127.0.0.1', |
|
40 | - 'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)', |
|
41 | - 'comment_date' => $time, |
|
42 | - 'comment_approved' => 1, |
|
43 | - ); |
|
44 | - |
|
45 | - $comment_id = wp_insert_comment($data); |
|
46 | - |
|
47 | - $_REQUEST['geodir_overallrating'] = 5.0; |
|
48 | - geodir_save_rating($comment_id); |
|
49 | - |
|
50 | - $this->assertTrue(is_int($comment_id)); |
|
51 | - |
|
52 | - //ajax function test |
|
53 | - $ajax_nonce = wp_create_nonce("geodir-bestof-nonce"); |
|
54 | - |
|
55 | - $terms = get_terms( array( |
|
56 | - 'taxonomy' => 'gd_placecategory', |
|
57 | - 'hide_empty' => false, |
|
58 | - ) ); |
|
59 | - $term_id = $terms[0]->term_id; |
|
60 | - |
|
61 | - $_POST['post_type'] = 'gd_place'; |
|
62 | - $_POST['post_limit'] = '5'; |
|
63 | - $_POST['char_count'] = '20'; |
|
64 | - $_POST['taxonomy'] = 'gd_placecategory'; |
|
65 | - $_POST['add_location_filter'] = '1'; |
|
66 | - $_POST['term_id'] = (string) $term_id; |
|
67 | - $_POST['excerpt_type'] = 'show-reviews'; |
|
68 | - $_POST['geodir_bestof_nonce'] = $ajax_nonce; |
|
69 | - |
|
70 | - $this->_handleAjax('geodir_bestof'); |
|
71 | - $this->assertContains("bestof-cat-title", $this->_last_response); |
|
72 | - |
|
73 | - |
|
74 | - } |
|
75 | - |
|
76 | - public function texstImportExport() { |
|
77 | - $nonce = wp_create_nonce( 'geodir_import_export_nonce' ); |
|
78 | - |
|
79 | - $_POST['_nonce'] = $nonce; |
|
80 | - $_POST['_pt'] = 'gd_place'; |
|
81 | - $_POST['task'] = 'export_posts'; |
|
82 | - $_POST['_n'] = 5000; |
|
83 | - $_POST['_p'] = 1; |
|
84 | - |
|
85 | - $this->_handleAjax('geodir_import_export'); |
|
86 | - try { |
|
87 | - $this->assertContains("bestof-cat-title", $this->_last_response); |
|
88 | - } catch (WPAjaxDieStopException $e) { |
|
89 | - var_dump("WPAjaxDieStopException: " . $e ); |
|
90 | - } catch (WPAjaxDieContinueException $e) { |
|
91 | - var_dump("WPAjaxDieContinueException: " . $e ); |
|
92 | - } |
|
93 | - |
|
94 | - } |
|
95 | - |
|
96 | - public function tearDown() |
|
97 | - { |
|
98 | - parent::tearDown(); |
|
99 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + wp_set_current_user(1); |
|
8 | + } |
|
9 | + |
|
10 | + public function testBestOfWidgetAjax() { |
|
11 | + $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
12 | + include_once($template); |
|
13 | + |
|
14 | + $time = current_time('mysql'); |
|
15 | + |
|
16 | + $query_args = array( |
|
17 | + 'post_status' => 'publish', |
|
18 | + 'post_type' => 'gd_place', |
|
19 | + 'posts_per_page' => 1, |
|
20 | + ); |
|
21 | + |
|
22 | + $all_posts = new WP_Query( $query_args ); |
|
23 | + $post_id = null; |
|
24 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
25 | + $post_id = get_the_ID(); |
|
26 | + endwhile; |
|
27 | + |
|
28 | + $this->assertTrue(is_int($post_id)); |
|
29 | + |
|
30 | + $data = array( |
|
31 | + 'comment_post_ID' => $post_id, |
|
32 | + 'comment_author' => 'admin', |
|
33 | + 'comment_author_email' => '[email protected]', |
|
34 | + 'comment_author_url' => 'http://wpgeodirectory.com', |
|
35 | + 'comment_content' => 'content here', |
|
36 | + 'comment_type' => '', |
|
37 | + 'comment_parent' => 0, |
|
38 | + 'user_id' => 1, |
|
39 | + 'comment_author_IP' => '127.0.0.1', |
|
40 | + 'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)', |
|
41 | + 'comment_date' => $time, |
|
42 | + 'comment_approved' => 1, |
|
43 | + ); |
|
44 | + |
|
45 | + $comment_id = wp_insert_comment($data); |
|
46 | + |
|
47 | + $_REQUEST['geodir_overallrating'] = 5.0; |
|
48 | + geodir_save_rating($comment_id); |
|
49 | + |
|
50 | + $this->assertTrue(is_int($comment_id)); |
|
51 | + |
|
52 | + //ajax function test |
|
53 | + $ajax_nonce = wp_create_nonce("geodir-bestof-nonce"); |
|
54 | + |
|
55 | + $terms = get_terms( array( |
|
56 | + 'taxonomy' => 'gd_placecategory', |
|
57 | + 'hide_empty' => false, |
|
58 | + ) ); |
|
59 | + $term_id = $terms[0]->term_id; |
|
60 | + |
|
61 | + $_POST['post_type'] = 'gd_place'; |
|
62 | + $_POST['post_limit'] = '5'; |
|
63 | + $_POST['char_count'] = '20'; |
|
64 | + $_POST['taxonomy'] = 'gd_placecategory'; |
|
65 | + $_POST['add_location_filter'] = '1'; |
|
66 | + $_POST['term_id'] = (string) $term_id; |
|
67 | + $_POST['excerpt_type'] = 'show-reviews'; |
|
68 | + $_POST['geodir_bestof_nonce'] = $ajax_nonce; |
|
69 | + |
|
70 | + $this->_handleAjax('geodir_bestof'); |
|
71 | + $this->assertContains("bestof-cat-title", $this->_last_response); |
|
72 | + |
|
73 | + |
|
74 | + } |
|
75 | + |
|
76 | + public function texstImportExport() { |
|
77 | + $nonce = wp_create_nonce( 'geodir_import_export_nonce' ); |
|
78 | + |
|
79 | + $_POST['_nonce'] = $nonce; |
|
80 | + $_POST['_pt'] = 'gd_place'; |
|
81 | + $_POST['task'] = 'export_posts'; |
|
82 | + $_POST['_n'] = 5000; |
|
83 | + $_POST['_p'] = 1; |
|
84 | + |
|
85 | + $this->_handleAjax('geodir_import_export'); |
|
86 | + try { |
|
87 | + $this->assertContains("bestof-cat-title", $this->_last_response); |
|
88 | + } catch (WPAjaxDieStopException $e) { |
|
89 | + var_dump("WPAjaxDieStopException: " . $e ); |
|
90 | + } catch (WPAjaxDieContinueException $e) { |
|
91 | + var_dump("WPAjaxDieContinueException: " . $e ); |
|
92 | + } |
|
93 | + |
|
94 | + } |
|
95 | + |
|
96 | + public function tearDown() |
|
97 | + { |
|
98 | + parent::tearDown(); |
|
99 | + } |
|
100 | 100 | } |
101 | 101 | ?> |
102 | 102 | \ No newline at end of file |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | } |
9 | 9 | |
10 | 10 | public function testBestOfWidgetAjax() { |
11 | - $template = geodir_plugin_path() . '/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
11 | + $template = geodir_plugin_path().'/geodirectory-widgets/geodirectory_bestof_widget.php'; |
|
12 | 12 | include_once($template); |
13 | 13 | |
14 | 14 | $time = current_time('mysql'); |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | 'posts_per_page' => 1, |
20 | 20 | ); |
21 | 21 | |
22 | - $all_posts = new WP_Query( $query_args ); |
|
22 | + $all_posts = new WP_Query($query_args); |
|
23 | 23 | $post_id = null; |
24 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
24 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
25 | 25 | $post_id = get_the_ID(); |
26 | 26 | endwhile; |
27 | 27 | |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | //ajax function test |
53 | 53 | $ajax_nonce = wp_create_nonce("geodir-bestof-nonce"); |
54 | 54 | |
55 | - $terms = get_terms( array( |
|
55 | + $terms = get_terms(array( |
|
56 | 56 | 'taxonomy' => 'gd_placecategory', |
57 | 57 | 'hide_empty' => false, |
58 | - ) ); |
|
58 | + )); |
|
59 | 59 | $term_id = $terms[0]->term_id; |
60 | 60 | |
61 | 61 | $_POST['post_type'] = 'gd_place'; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | public function texstImportExport() { |
77 | - $nonce = wp_create_nonce( 'geodir_import_export_nonce' ); |
|
77 | + $nonce = wp_create_nonce('geodir_import_export_nonce'); |
|
78 | 78 | |
79 | 79 | $_POST['_nonce'] = $nonce; |
80 | 80 | $_POST['_pt'] = 'gd_place'; |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | try { |
87 | 87 | $this->assertContains("bestof-cat-title", $this->_last_response); |
88 | 88 | } catch (WPAjaxDieStopException $e) { |
89 | - var_dump("WPAjaxDieStopException: " . $e ); |
|
89 | + var_dump("WPAjaxDieStopException: ".$e); |
|
90 | 90 | } catch (WPAjaxDieContinueException $e) { |
91 | - var_dump("WPAjaxDieContinueException: " . $e ); |
|
91 | + var_dump("WPAjaxDieContinueException: ".$e); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | } |
@@ -1,68 +1,68 @@ |
||
1 | 1 | <?php |
2 | 2 | class UserTest extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - wp_set_current_user(1); |
|
8 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + wp_set_current_user(1); |
|
8 | + } |
|
9 | 9 | |
10 | - public function testDisplayUserFavorites() { |
|
10 | + public function testDisplayUserFavorites() { |
|
11 | 11 | |
12 | - global $current_user; |
|
12 | + global $current_user; |
|
13 | 13 | |
14 | - $user_id = $current_user->ID; |
|
14 | + $user_id = $current_user->ID; |
|
15 | 15 | |
16 | - $query_args = array( |
|
17 | - 'post_status' => 'publish', |
|
18 | - 'post_type' => 'gd_place', |
|
19 | - 'posts_per_page' => 1, |
|
20 | - ); |
|
16 | + $query_args = array( |
|
17 | + 'post_status' => 'publish', |
|
18 | + 'post_type' => 'gd_place', |
|
19 | + 'posts_per_page' => 1, |
|
20 | + ); |
|
21 | 21 | |
22 | - $all_posts = new WP_Query( $query_args ); |
|
23 | - $post_id = null; |
|
24 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
25 | - $post_id = get_the_ID(); |
|
26 | - endwhile; |
|
22 | + $all_posts = new WP_Query( $query_args ); |
|
23 | + $post_id = null; |
|
24 | + while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
25 | + $post_id = get_the_ID(); |
|
26 | + endwhile; |
|
27 | 27 | |
28 | - $this->assertTrue(is_int($post_id)); |
|
28 | + $this->assertTrue(is_int($post_id)); |
|
29 | 29 | |
30 | - ob_start(); |
|
31 | - geodir_add_to_favorite($post_id); |
|
32 | - $output = ob_get_contents(); |
|
33 | - ob_end_clean(); |
|
34 | - $this->assertContains( 'Remove from Favorites', $output ); |
|
30 | + ob_start(); |
|
31 | + geodir_add_to_favorite($post_id); |
|
32 | + $output = ob_get_contents(); |
|
33 | + ob_end_clean(); |
|
34 | + $this->assertContains( 'Remove from Favorites', $output ); |
|
35 | 35 | |
36 | 36 | |
37 | - $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
37 | + $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
|
38 | 38 | |
39 | - $this->assertContains( $post_id, $user_fav_posts ); |
|
39 | + $this->assertContains( $post_id, $user_fav_posts ); |
|
40 | 40 | |
41 | - ob_start(); |
|
42 | - geodir_user_show_favourites($user_id); |
|
43 | - $output = ob_get_contents(); |
|
44 | - ob_end_clean(); |
|
45 | - $this->assertContains( 'geodir_my_favourites', $output ); |
|
41 | + ob_start(); |
|
42 | + geodir_user_show_favourites($user_id); |
|
43 | + $output = ob_get_contents(); |
|
44 | + ob_end_clean(); |
|
45 | + $this->assertContains( 'geodir_my_favourites', $output ); |
|
46 | 46 | |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | - public function testDisplayUserListings() { |
|
49 | + public function testDisplayUserListings() { |
|
50 | 50 | |
51 | - global $current_user; |
|
51 | + global $current_user; |
|
52 | 52 | |
53 | - $user_id = $current_user->ID; |
|
53 | + $user_id = $current_user->ID; |
|
54 | 54 | |
55 | - ob_start(); |
|
56 | - geodir_user_show_listings($user_id); |
|
57 | - $output = ob_get_contents(); |
|
58 | - ob_end_clean(); |
|
59 | - $this->assertContains( 'geodir_my_listings', $output ); |
|
55 | + ob_start(); |
|
56 | + geodir_user_show_listings($user_id); |
|
57 | + $output = ob_get_contents(); |
|
58 | + ob_end_clean(); |
|
59 | + $this->assertContains( 'geodir_my_listings', $output ); |
|
60 | 60 | |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | - public function tearDown() |
|
64 | - { |
|
65 | - parent::tearDown(); |
|
66 | - } |
|
63 | + public function tearDown() |
|
64 | + { |
|
65 | + parent::tearDown(); |
|
66 | + } |
|
67 | 67 | } |
68 | 68 | ?> |
69 | 69 | \ No newline at end of file |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | 'posts_per_page' => 1, |
20 | 20 | ); |
21 | 21 | |
22 | - $all_posts = new WP_Query( $query_args ); |
|
22 | + $all_posts = new WP_Query($query_args); |
|
23 | 23 | $post_id = null; |
24 | - while ( $all_posts->have_posts() ) : $all_posts->the_post(); |
|
24 | + while ($all_posts->have_posts()) : $all_posts->the_post(); |
|
25 | 25 | $post_id = get_the_ID(); |
26 | 26 | endwhile; |
27 | 27 | |
@@ -31,18 +31,18 @@ discard block |
||
31 | 31 | geodir_add_to_favorite($post_id); |
32 | 32 | $output = ob_get_contents(); |
33 | 33 | ob_end_clean(); |
34 | - $this->assertContains( 'Remove from Favorites', $output ); |
|
34 | + $this->assertContains('Remove from Favorites', $output); |
|
35 | 35 | |
36 | 36 | |
37 | 37 | $user_fav_posts = get_user_meta($user_id, 'gd_user_favourite_post', true); |
38 | 38 | |
39 | - $this->assertContains( $post_id, $user_fav_posts ); |
|
39 | + $this->assertContains($post_id, $user_fav_posts); |
|
40 | 40 | |
41 | 41 | ob_start(); |
42 | 42 | geodir_user_show_favourites($user_id); |
43 | 43 | $output = ob_get_contents(); |
44 | 44 | ob_end_clean(); |
45 | - $this->assertContains( 'geodir_my_favourites', $output ); |
|
45 | + $this->assertContains('geodir_my_favourites', $output); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | geodir_user_show_listings($user_id); |
57 | 57 | $output = ob_get_contents(); |
58 | 58 | ob_end_clean(); |
59 | - $this->assertContains( 'geodir_my_listings', $output ); |
|
59 | + $this->assertContains('geodir_my_listings', $output); |
|
60 | 60 | |
61 | 61 | } |
62 | 62 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | function drop_tables() { |
30 | 30 | global $wpdb, $plugin_prefix; |
31 | 31 | //build our query to delete our custom table |
32 | - $sql = "DROP TABLE IF EXISTS " . GEODIR_COUNTRIES_TABLE . ", " . GEODIR_ICON_TABLE . ", " . GEODIR_CUSTOM_FIELDS_TABLE . ", " . $plugin_prefix . "gd_place_detail, " . GEODIR_ATTACHMENT_TABLE . ", " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . ", " . GEODIR_REVIEW_TABLE . ";"; |
|
32 | + $sql = "DROP TABLE IF EXISTS ".GEODIR_COUNTRIES_TABLE.", ".GEODIR_ICON_TABLE.", ".GEODIR_CUSTOM_FIELDS_TABLE.", ".$plugin_prefix."gd_place_detail, ".GEODIR_ATTACHMENT_TABLE.", ".GEODIR_CUSTOM_SORT_FIELDS_TABLE.", ".GEODIR_REVIEW_TABLE.";"; |
|
33 | 33 | |
34 | 34 | //execute the query deleting the table |
35 | 35 | $wpdb->query($sql); |
@@ -1,102 +1,102 @@ |
||
1 | 1 | <?php |
2 | 2 | class MiscTests extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - wp_set_current_user(1); |
|
8 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + wp_set_current_user(1); |
|
8 | + } |
|
9 | 9 | |
10 | - public function testOptionDesignSettings() { |
|
10 | + public function testOptionDesignSettings() { |
|
11 | 11 | |
12 | - geodir_post_type_setting_fun(); |
|
13 | - global $geodir_settings; |
|
12 | + geodir_post_type_setting_fun(); |
|
13 | + global $geodir_settings; |
|
14 | 14 | |
15 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/design_settings_array.php'; |
|
16 | - include_once($template); |
|
15 | + $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/design_settings_array.php'; |
|
16 | + include_once($template); |
|
17 | 17 | |
18 | - $output = $geodir_settings['design_settings']; |
|
18 | + $output = $geodir_settings['design_settings']; |
|
19 | 19 | |
20 | - $this->assertContains('Home Top Section Settings', $output[1]['name']); |
|
21 | - } |
|
20 | + $this->assertContains('Home Top Section Settings', $output[1]['name']); |
|
21 | + } |
|
22 | 22 | |
23 | - public function testOptionGeneralSettings() { |
|
23 | + public function testOptionGeneralSettings() { |
|
24 | 24 | |
25 | - geodir_post_type_setting_fun(); |
|
26 | - global $geodir_settings; |
|
25 | + geodir_post_type_setting_fun(); |
|
26 | + global $geodir_settings; |
|
27 | 27 | |
28 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/general_settings_array.php'; |
|
29 | - include_once($template); |
|
28 | + $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/general_settings_array.php'; |
|
29 | + include_once($template); |
|
30 | 30 | |
31 | - $output = $geodir_settings['general_settings']; |
|
31 | + $output = $geodir_settings['general_settings']; |
|
32 | 32 | |
33 | - $this->assertContains('General', $output[0]['name']); |
|
34 | - } |
|
33 | + $this->assertContains('General', $output[0]['name']); |
|
34 | + } |
|
35 | 35 | |
36 | - public function testOptionNotiSettings() { |
|
36 | + public function testOptionNotiSettings() { |
|
37 | 37 | |
38 | - geodir_post_type_setting_fun(); |
|
39 | - global $geodir_settings; |
|
38 | + geodir_post_type_setting_fun(); |
|
39 | + global $geodir_settings; |
|
40 | 40 | |
41 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/notifications_settings_array.php'; |
|
42 | - include_once($template); |
|
41 | + $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/notifications_settings_array.php'; |
|
42 | + include_once($template); |
|
43 | 43 | |
44 | - $output = $geodir_settings['notifications_settings']; |
|
44 | + $output = $geodir_settings['notifications_settings']; |
|
45 | 45 | |
46 | - $this->assertContains('Options', $output[0]['name']); |
|
47 | - } |
|
46 | + $this->assertContains('Options', $output[0]['name']); |
|
47 | + } |
|
48 | 48 | |
49 | - public function testOptionPermalinkSettings() { |
|
49 | + public function testOptionPermalinkSettings() { |
|
50 | 50 | |
51 | - geodir_post_type_setting_fun(); |
|
52 | - global $geodir_settings; |
|
51 | + geodir_post_type_setting_fun(); |
|
52 | + global $geodir_settings; |
|
53 | 53 | |
54 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/permalink_settings_array.php'; |
|
55 | - include_once($template); |
|
54 | + $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/permalink_settings_array.php'; |
|
55 | + include_once($template); |
|
56 | 56 | |
57 | - $output = $geodir_settings['permalink_settings']; |
|
57 | + $output = $geodir_settings['permalink_settings']; |
|
58 | 58 | |
59 | - $this->assertContains('Permalink', $output[0]['name']); |
|
60 | - } |
|
59 | + $this->assertContains('Permalink', $output[0]['name']); |
|
60 | + } |
|
61 | 61 | |
62 | - public function testOptionMetaSettings() { |
|
62 | + public function testOptionMetaSettings() { |
|
63 | 63 | |
64 | - geodir_post_type_setting_fun(); |
|
65 | - global $geodir_settings; |
|
64 | + geodir_post_type_setting_fun(); |
|
65 | + global $geodir_settings; |
|
66 | 66 | |
67 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/title_meta_settings_array.php'; |
|
68 | - include_once($template); |
|
67 | + $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/title_meta_settings_array.php'; |
|
68 | + include_once($template); |
|
69 | 69 | |
70 | - $output = $geodir_settings['title_meta_settings']; |
|
70 | + $output = $geodir_settings['title_meta_settings']; |
|
71 | 71 | |
72 | - $this->assertContains('Title / Meta', $output[0]['name']); |
|
73 | - } |
|
72 | + $this->assertContains('Title / Meta', $output[0]['name']); |
|
73 | + } |
|
74 | 74 | |
75 | - public function testDiagnose() { |
|
76 | - ob_start(); |
|
77 | - geodir_diagnose_default_pages(); |
|
78 | - $output = ob_get_contents(); |
|
79 | - ob_end_clean(); |
|
80 | - $this->assertContains( 'GD Home page exists with proper setting', $output ); |
|
81 | - $this->assertContains( 'Add Listing page exists with proper setting', $output ); |
|
82 | - $this->assertContains( 'Listing Preview page exists with proper setting', $output ); |
|
83 | - $this->assertContains( 'Listing Success page exists with proper setting', $output ); |
|
84 | - $this->assertContains( 'Info page exists with proper setting', $output ); |
|
85 | - $this->assertContains( 'Login page exists with proper setting', $output ); |
|
86 | - $this->assertContains( 'Location page exists with proper setting', $output ); |
|
75 | + public function testDiagnose() { |
|
76 | + ob_start(); |
|
77 | + geodir_diagnose_default_pages(); |
|
78 | + $output = ob_get_contents(); |
|
79 | + ob_end_clean(); |
|
80 | + $this->assertContains( 'GD Home page exists with proper setting', $output ); |
|
81 | + $this->assertContains( 'Add Listing page exists with proper setting', $output ); |
|
82 | + $this->assertContains( 'Listing Preview page exists with proper setting', $output ); |
|
83 | + $this->assertContains( 'Listing Success page exists with proper setting', $output ); |
|
84 | + $this->assertContains( 'Info page exists with proper setting', $output ); |
|
85 | + $this->assertContains( 'Login page exists with proper setting', $output ); |
|
86 | + $this->assertContains( 'Location page exists with proper setting', $output ); |
|
87 | 87 | |
88 | - ob_start(); |
|
89 | - geodir_diagnose_load_db_language(); |
|
90 | - $output = ob_get_contents(); |
|
91 | - ob_end_clean(); |
|
92 | - $this->assertContains( 'ul', $output ); |
|
88 | + ob_start(); |
|
89 | + geodir_diagnose_load_db_language(); |
|
90 | + $output = ob_get_contents(); |
|
91 | + ob_end_clean(); |
|
92 | + $this->assertContains( 'ul', $output ); |
|
93 | 93 | |
94 | - } |
|
94 | + } |
|
95 | 95 | |
96 | - public function tearDown() |
|
97 | - { |
|
98 | - parent::tearDown(); |
|
99 | - } |
|
96 | + public function tearDown() |
|
97 | + { |
|
98 | + parent::tearDown(); |
|
99 | + } |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | ?> |
103 | 103 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | geodir_post_type_setting_fun(); |
13 | 13 | global $geodir_settings; |
14 | 14 | |
15 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/design_settings_array.php'; |
|
15 | + $template = geodir_plugin_path().'/geodirectory-admin/option-pages/design_settings_array.php'; |
|
16 | 16 | include_once($template); |
17 | 17 | |
18 | 18 | $output = $geodir_settings['design_settings']; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | geodir_post_type_setting_fun(); |
26 | 26 | global $geodir_settings; |
27 | 27 | |
28 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/general_settings_array.php'; |
|
28 | + $template = geodir_plugin_path().'/geodirectory-admin/option-pages/general_settings_array.php'; |
|
29 | 29 | include_once($template); |
30 | 30 | |
31 | 31 | $output = $geodir_settings['general_settings']; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | geodir_post_type_setting_fun(); |
39 | 39 | global $geodir_settings; |
40 | 40 | |
41 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/notifications_settings_array.php'; |
|
41 | + $template = geodir_plugin_path().'/geodirectory-admin/option-pages/notifications_settings_array.php'; |
|
42 | 42 | include_once($template); |
43 | 43 | |
44 | 44 | $output = $geodir_settings['notifications_settings']; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | geodir_post_type_setting_fun(); |
52 | 52 | global $geodir_settings; |
53 | 53 | |
54 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/permalink_settings_array.php'; |
|
54 | + $template = geodir_plugin_path().'/geodirectory-admin/option-pages/permalink_settings_array.php'; |
|
55 | 55 | include_once($template); |
56 | 56 | |
57 | 57 | $output = $geodir_settings['permalink_settings']; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | geodir_post_type_setting_fun(); |
65 | 65 | global $geodir_settings; |
66 | 66 | |
67 | - $template = geodir_plugin_path() . '/geodirectory-admin/option-pages/title_meta_settings_array.php'; |
|
67 | + $template = geodir_plugin_path().'/geodirectory-admin/option-pages/title_meta_settings_array.php'; |
|
68 | 68 | include_once($template); |
69 | 69 | |
70 | 70 | $output = $geodir_settings['title_meta_settings']; |
@@ -77,19 +77,19 @@ discard block |
||
77 | 77 | geodir_diagnose_default_pages(); |
78 | 78 | $output = ob_get_contents(); |
79 | 79 | ob_end_clean(); |
80 | - $this->assertContains( 'GD Home page exists with proper setting', $output ); |
|
81 | - $this->assertContains( 'Add Listing page exists with proper setting', $output ); |
|
82 | - $this->assertContains( 'Listing Preview page exists with proper setting', $output ); |
|
83 | - $this->assertContains( 'Listing Success page exists with proper setting', $output ); |
|
84 | - $this->assertContains( 'Info page exists with proper setting', $output ); |
|
85 | - $this->assertContains( 'Login page exists with proper setting', $output ); |
|
86 | - $this->assertContains( 'Location page exists with proper setting', $output ); |
|
80 | + $this->assertContains('GD Home page exists with proper setting', $output); |
|
81 | + $this->assertContains('Add Listing page exists with proper setting', $output); |
|
82 | + $this->assertContains('Listing Preview page exists with proper setting', $output); |
|
83 | + $this->assertContains('Listing Success page exists with proper setting', $output); |
|
84 | + $this->assertContains('Info page exists with proper setting', $output); |
|
85 | + $this->assertContains('Login page exists with proper setting', $output); |
|
86 | + $this->assertContains('Location page exists with proper setting', $output); |
|
87 | 87 | |
88 | 88 | ob_start(); |
89 | 89 | geodir_diagnose_load_db_language(); |
90 | 90 | $output = ob_get_contents(); |
91 | 91 | ob_end_clean(); |
92 | - $this->assertContains( 'ul', $output ); |
|
92 | + $this->assertContains('ul', $output); |
|
93 | 93 | |
94 | 94 | } |
95 | 95 |
@@ -1,75 +1,75 @@ |
||
1 | 1 | <?php |
2 | 2 | class AdminTests extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - wp_set_current_user(1); |
|
8 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + wp_set_current_user(1); |
|
8 | + } |
|
9 | 9 | |
10 | - public function testAdminPanel() |
|
11 | - { |
|
10 | + public function testAdminPanel() |
|
11 | + { |
|
12 | 12 | |
13 | - $_POST = array( |
|
14 | - 'geodir_wrapper_open_id' => '', |
|
15 | - 'geodir_wrapper_open_class' => 'main-container clearfix', |
|
16 | - 'geodir_wrapper_open_replace' => '', |
|
17 | - 'geodir_wrapper_close_replace' => '', |
|
18 | - 'geodir_wrapper_content_open_id' => '', |
|
19 | - 'geodir_wrapper_content_open_class' => '', |
|
20 | - 'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content "><div class="site-content page-wrap">', |
|
21 | - 'geodir_wrapper_content_close_replace' => '</div></div></div>', |
|
22 | - 'geodir_article_open_id' => '', |
|
23 | - 'geodir_article_open_class' => '', |
|
24 | - 'geodir_article_open_replace' => '', |
|
25 | - 'geodir_article_close_replace' => '', |
|
26 | - 'geodir_sidebar_right_open_id' => '', |
|
27 | - 'geodir_sidebar_right_open_class' => '', |
|
28 | - 'geodir_sidebar_right_open_replace' => '<aside class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
29 | - 'geodir_sidebar_right_close_replace' => '', |
|
30 | - 'geodir_sidebar_left_open_id' => '', |
|
31 | - 'geodir_sidebar_left_open_class' => '', |
|
32 | - 'geodir_sidebar_left_open_replace' => '<aside class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
33 | - 'geodir_sidebar_left_close_replace' => '', |
|
34 | - 'geodir_main_content_open_id' => '', |
|
35 | - 'geodir_main_content_open_class' => '', |
|
36 | - 'geodir_main_content_open_replace' => '<div class="site-content page-wrap">', |
|
37 | - 'geodir_main_content_close_replace' => '</div>', |
|
38 | - 'geodir_top_content_add' => '', |
|
39 | - 'geodir_before_main_content_add' => '', |
|
40 | - 'geodir_full_page_class_filter' => 'section full-width-section', |
|
41 | - 'geodir_before_widget_filter' => '', |
|
42 | - 'geodir_after_widget_filter' => '', |
|
43 | - 'geodir_before_title_filter' => '<div class="widget-title"><h2>', |
|
44 | - 'geodir_after_title_filter' => '</h2></div>', |
|
45 | - 'geodir_menu_li_class_filter' => '', |
|
46 | - 'geodir_sub_menu_ul_class_filter' => '', |
|
47 | - 'geodir_sub_menu_li_class_filter' => '', |
|
48 | - 'geodir_menu_a_class_filter' => '', |
|
49 | - 'geodir_sub_menu_a_class_filter' => '', |
|
50 | - 'geodir_location_switcher_menu_li_class_filter' => '', |
|
51 | - 'geodir_location_switcher_menu_a_class_filter' => '', |
|
52 | - 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
53 | - 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
54 | - 'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'), |
|
55 | - 'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});', |
|
56 | - 'geodir_theme_compat_default_options' => '', |
|
57 | - 'geodir_theme_compat_code' => 'Multi_News', |
|
58 | - 'gd_theme_compat' => 'Twenty_Fifteen_custom' |
|
59 | - ); |
|
60 | - geodir_update_options_compatibility_settings(); |
|
13 | + $_POST = array( |
|
14 | + 'geodir_wrapper_open_id' => '', |
|
15 | + 'geodir_wrapper_open_class' => 'main-container clearfix', |
|
16 | + 'geodir_wrapper_open_replace' => '', |
|
17 | + 'geodir_wrapper_close_replace' => '', |
|
18 | + 'geodir_wrapper_content_open_id' => '', |
|
19 | + 'geodir_wrapper_content_open_class' => '', |
|
20 | + 'geodir_wrapper_content_open_replace' => '<div class="main-left" ><div class="main-content "><div class="site-content page-wrap">', |
|
21 | + 'geodir_wrapper_content_close_replace' => '</div></div></div>', |
|
22 | + 'geodir_article_open_id' => '', |
|
23 | + 'geodir_article_open_class' => '', |
|
24 | + 'geodir_article_open_replace' => '', |
|
25 | + 'geodir_article_close_replace' => '', |
|
26 | + 'geodir_sidebar_right_open_id' => '', |
|
27 | + 'geodir_sidebar_right_open_class' => '', |
|
28 | + 'geodir_sidebar_right_open_replace' => '<aside class="sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
29 | + 'geodir_sidebar_right_close_replace' => '', |
|
30 | + 'geodir_sidebar_left_open_id' => '', |
|
31 | + 'geodir_sidebar_left_open_class' => '', |
|
32 | + 'geodir_sidebar_left_open_replace' => '<aside class="secondary-sidebar" role="complementary" itemscope itemtype="[itemtype]" >', |
|
33 | + 'geodir_sidebar_left_close_replace' => '', |
|
34 | + 'geodir_main_content_open_id' => '', |
|
35 | + 'geodir_main_content_open_class' => '', |
|
36 | + 'geodir_main_content_open_replace' => '<div class="site-content page-wrap">', |
|
37 | + 'geodir_main_content_close_replace' => '</div>', |
|
38 | + 'geodir_top_content_add' => '', |
|
39 | + 'geodir_before_main_content_add' => '', |
|
40 | + 'geodir_full_page_class_filter' => 'section full-width-section', |
|
41 | + 'geodir_before_widget_filter' => '', |
|
42 | + 'geodir_after_widget_filter' => '', |
|
43 | + 'geodir_before_title_filter' => '<div class="widget-title"><h2>', |
|
44 | + 'geodir_after_title_filter' => '</h2></div>', |
|
45 | + 'geodir_menu_li_class_filter' => '', |
|
46 | + 'geodir_sub_menu_ul_class_filter' => '', |
|
47 | + 'geodir_sub_menu_li_class_filter' => '', |
|
48 | + 'geodir_menu_a_class_filter' => '', |
|
49 | + 'geodir_sub_menu_a_class_filter' => '', |
|
50 | + 'geodir_location_switcher_menu_li_class_filter' => '', |
|
51 | + 'geodir_location_switcher_menu_a_class_filter' => '', |
|
52 | + 'geodir_location_switcher_menu_sub_ul_class_filter' => '', |
|
53 | + 'geodir_location_switcher_menu_sub_li_class_filter' => '', |
|
54 | + 'geodir_theme_compat_css' => stripslashes('.full-width-section .geodir-search{margin:0;width:100%}.geodir_full_page .geodir-search{margin:0 auto;float:none}.geodir-search input[type=button],.geodir-search input[type=submit]{width:13%}.geodir-search input[type=text]{border:1px solid #ddd;border-radius:0;padding:0 8px}.geodir-category-list-in,.geodir-loc-bar-in{background:#f2f2f2;border-color:#dbdbdb}.geodir-category-list-in{margin-top:0}.geodir-cat-list .widget-title h2{margin:-13px -13px 13px}.widget .geodir-cat-list ul li.geodir-pcat-show a:before{display:none!important}.widget .geodir-cat-list ul li.geodir-pcat-show i{margin-right:5px}.container .geodir-search select{margin:0 3% 0 0;padding:8px 10px;width:13%}#geodir_carousel,#geodir_slider{border-radius:0;-webkit-border-radius:0;-moz-border-radius:0;margin-bottom:20px!important;border:1px solid #e1e1e1;box-shadow:none}#geodir_carousel{padding:10px}.geodir-tabs-content ol.commentlist{margin:40px 0;padding:0}li#post_mapTab{min-height:400px}#reviewsTab ol.commentlist li{border-bottom:none}#reviewsTab ol.commentlist li article.comment{border-bottom:1px solid #e1e1e1;padding-bottom:10px}.comment-content .rating{display:none}.comment-respond .gd_rating{margin-bottom:20px}div.geodir-rating{width:85px!important}.comment-respond .comment-notes{margin-bottom:10px}.average-review span,.comment-form label,.dtreviewed,.geodir-details-sidebar-user-links a,.geodir-viewall,.geodir_more_info span,.reviewer,dl.geodir-tab-head dd a{font-family:"Archivo Narrow",sans-serif}section.comment-content{margin:0 0 0 12%}#reviewsTab .comments-area .comment-content{width:auto}section.comment-content .description,section.comment-content p{margin:15px 0}dl.geodir-tab-head dd a{background:#f3f3f3;margin-top:-1px;font-size:14px;padding:0 15px}dl.geodir-tab-head dd.geodir-tab-active a{padding-bottom:1px}.geodir-widget .geodir_list_heading,.geodir-widget h3.widget-title{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px;color:#2d2d2d}.geodir-widget .geodir_list_heading h3{background:0 0;border:none}.geodir-widget .geodir_list_heading{margin:-13px -14px 13px}.geodir-map-listing-page{border-width:1px 0 0;border-style:solid;border-color:#dbdbdb}.geodir-sidebar-wrap .geodir-company_info{margin:15px}.geodir-details-sidebar-social-sharing iframe{float:left}.geodir-details-sidebar-rating{overflow:hidden}.geodir-details-sidebar-rating .gd_rating_show,.geodir-details-sidebar-rating .geodir-rating{float:left;margin-right:15px}.geodir-details-sidebar-rating span.item{float:left;margin-top:5px}.geodir-details-sidebar-rating .average-review{top:-4px;position:relative}.geodir-details-sidebar-rating span.item img{margin-top:5px}.geodir_full_page{background:#fff;border:1px solid #e1e1e1;-webkit-box-shadow:0 1px 0 #e5e5e5;box-shadow:0 1px 0 #e5e5e5;padding:15px;margin-bottom:20px;clear:both}.geodir_map_container .main_list img{margin:0 5px}.geodir_category_list_view li.geodir-gridview .geodir-post-img .geodir_thumbnail{margin-bottom:10px}.geodir-addinfo .geodir-pinpoint,.geodir-addinfo a i{margin-right:5px}.geodir_category_list_view li.geodir-gridview h3{font-size:18px;margin-bottom:10px}#related_listingTab ul.geodir_category_list_view{padding:0!important}#reviewsTab #comments .gd_rating{margin-top:5px}.widget .geodir_category_list_view li .geodir-entry-content,.widget .geodir_category_list_view li a:before{display:none!important}.geodir_category_list_view li .geodir-entry-title{margin-bottom:10px}.widget ul.geodir_category_list_view{padding:15px}.sidebar .widget .geodir_category_list_view li{width:calc(100% - 25px)}.widget .geodir-loginbox-list li{overflow:visible!important}.widget ul.chosen-results{margin:0!important}.main_list_selecter{margin-right:5px}.geodir-viewall{float:right;width:auto!important}.widget-title h2{padding:0 15px;background:#e9e9e9;border:1px solid #dbdbdb;height:38px;line-height:38px}.widget:first-child .geodir_list_heading .widget-title{margin-top:0}.geodir_list_heading .widget-title{float:left;width:80%;margin-top:0}.geodir_list_heading .widget-title h2{padding:0 px;background:0 0;border:none;height:auto;line-height:auto}.chosen-default:before{content:none;display:none;position:absolute;margin-left:-1000000px;float:left}#geodir-wrapper .entry-crumbs{margin-bottom:20px}.geodir-search .mom-select{float:left;width:150px;margin:5px;border:1px solid #ddd;height:40px}.iprelative .gm-style .gm-style-iw{width:100%!important}'), |
|
55 | + 'geodir_theme_compat_js' => 'jQuery(document).ready(function(e){e(".geodir_full_page").length&&""===e.trim(e(".geodir_full_page").html())&&e(".geodir_full_page").css({display:"none"})});', |
|
56 | + 'geodir_theme_compat_default_options' => '', |
|
57 | + 'geodir_theme_compat_code' => 'Multi_News', |
|
58 | + 'gd_theme_compat' => 'Twenty_Fifteen_custom' |
|
59 | + ); |
|
60 | + geodir_update_options_compatibility_settings(); |
|
61 | 61 | |
62 | - ob_start(); |
|
63 | - geodir_admin_panel(); |
|
64 | - $output = ob_get_contents(); |
|
65 | - ob_end_clean(); |
|
66 | - $this->assertContains( 'gd-wrapper-main', $output ); |
|
62 | + ob_start(); |
|
63 | + geodir_admin_panel(); |
|
64 | + $output = ob_get_contents(); |
|
65 | + ob_end_clean(); |
|
66 | + $this->assertContains( 'gd-wrapper-main', $output ); |
|
67 | 67 | |
68 | - } |
|
68 | + } |
|
69 | 69 | |
70 | - public function tearDown() |
|
71 | - { |
|
72 | - parent::tearDown(); |
|
73 | - } |
|
70 | + public function tearDown() |
|
71 | + { |
|
72 | + parent::tearDown(); |
|
73 | + } |
|
74 | 74 | } |
75 | 75 | ?> |
76 | 76 | \ No newline at end of file |
@@ -63,7 +63,7 @@ |
||
63 | 63 | geodir_admin_panel(); |
64 | 64 | $output = ob_get_contents(); |
65 | 65 | ob_end_clean(); |
66 | - $this->assertContains( 'gd-wrapper-main', $output ); |
|
66 | + $this->assertContains('gd-wrapper-main', $output); |
|
67 | 67 | |
68 | 68 | } |
69 | 69 |
@@ -1,102 +1,102 @@ |
||
1 | 1 | <?php |
2 | 2 | class Register extends WP_UnitTestCase |
3 | 3 | { |
4 | - public function setUp() |
|
5 | - { |
|
6 | - parent::setUp(); |
|
7 | - wp_set_current_user(0); |
|
8 | - } |
|
4 | + public function setUp() |
|
5 | + { |
|
6 | + parent::setUp(); |
|
7 | + wp_set_current_user(0); |
|
8 | + } |
|
9 | 9 | |
10 | - public function test_register_empty_username() { |
|
11 | - $errors = geodir_register_new_user( |
|
12 | - '', |
|
13 | - '[email protected]' |
|
14 | - ); |
|
15 | - $errors = (array) $errors; |
|
16 | - $this->assertArrayHasKey( 'empty_username', $errors["errors"] ); |
|
17 | - $this->assertContains( 'Please enter a username', $errors["errors"]["empty_username"][0] ); |
|
18 | - } |
|
10 | + public function test_register_empty_username() { |
|
11 | + $errors = geodir_register_new_user( |
|
12 | + '', |
|
13 | + '[email protected]' |
|
14 | + ); |
|
15 | + $errors = (array) $errors; |
|
16 | + $this->assertArrayHasKey( 'empty_username', $errors["errors"] ); |
|
17 | + $this->assertContains( 'Please enter a username', $errors["errors"]["empty_username"][0] ); |
|
18 | + } |
|
19 | 19 | |
20 | - public function test_register_invalid_username() { |
|
21 | - $errors = geodir_register_new_user( |
|
22 | - '@#$%^', |
|
23 | - '[email protected]' |
|
24 | - ); |
|
25 | - $errors = (array) $errors; |
|
26 | - $this->assertArrayHasKey( 'invalid_username', $errors["errors"] ); |
|
27 | - $this->assertContains( 'This username is invalid', $errors["errors"]["invalid_username"][0] ); |
|
28 | - } |
|
20 | + public function test_register_invalid_username() { |
|
21 | + $errors = geodir_register_new_user( |
|
22 | + '@#$%^', |
|
23 | + '[email protected]' |
|
24 | + ); |
|
25 | + $errors = (array) $errors; |
|
26 | + $this->assertArrayHasKey( 'invalid_username', $errors["errors"] ); |
|
27 | + $this->assertContains( 'This username is invalid', $errors["errors"]["invalid_username"][0] ); |
|
28 | + } |
|
29 | 29 | |
30 | - public function test_register_invalid_email() { |
|
31 | - $errors = geodir_register_new_user( |
|
32 | - 'hello', |
|
33 | - 'hello@@hi.com' |
|
34 | - ); |
|
35 | - $errors = (array) $errors; |
|
36 | - $this->assertArrayHasKey( 'invalid_email', $errors["errors"] ); |
|
37 | - $this->assertContains( 'The email address isn’t correct', $errors["errors"]["invalid_email"][0] ); |
|
38 | - } |
|
30 | + public function test_register_invalid_email() { |
|
31 | + $errors = geodir_register_new_user( |
|
32 | + 'hello', |
|
33 | + 'hello@@hi.com' |
|
34 | + ); |
|
35 | + $errors = (array) $errors; |
|
36 | + $this->assertArrayHasKey( 'invalid_email', $errors["errors"] ); |
|
37 | + $this->assertContains( 'The email address isn’t correct', $errors["errors"]["invalid_email"][0] ); |
|
38 | + } |
|
39 | 39 | |
40 | - public function test_register_empty_email() { |
|
41 | - $errors = geodir_register_new_user( |
|
42 | - 'hello', |
|
43 | - '' |
|
44 | - ); |
|
45 | - $errors = (array) $errors; |
|
46 | - $this->assertArrayHasKey( 'empty_email', $errors["errors"] ); |
|
47 | - $this->assertContains( 'Please type your e-mail address', $errors["errors"]["empty_email"][0] ); |
|
48 | - } |
|
40 | + public function test_register_empty_email() { |
|
41 | + $errors = geodir_register_new_user( |
|
42 | + 'hello', |
|
43 | + '' |
|
44 | + ); |
|
45 | + $errors = (array) $errors; |
|
46 | + $this->assertArrayHasKey( 'empty_email', $errors["errors"] ); |
|
47 | + $this->assertContains( 'Please type your e-mail address', $errors["errors"]["empty_email"][0] ); |
|
48 | + } |
|
49 | 49 | |
50 | - public function test_register_invalid_password() { |
|
51 | - update_option('geodir_allow_cpass', 1); |
|
52 | - $_REQUEST['user_pass'] = '12345'; |
|
53 | - $_REQUEST['user_pass2'] = '1234'; |
|
54 | - $_POST['user_fname'] = 'Test User'; |
|
55 | - $errors = geodir_register_new_user( |
|
56 | - 'hello', |
|
57 | - '[email protected]' |
|
58 | - ); |
|
59 | - $errors = (array) $errors; |
|
60 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
61 | - $this->assertContains( 'Passwords do not match', $errors["errors"]["pass_match"][0] ); |
|
50 | + public function test_register_invalid_password() { |
|
51 | + update_option('geodir_allow_cpass', 1); |
|
52 | + $_REQUEST['user_pass'] = '12345'; |
|
53 | + $_REQUEST['user_pass2'] = '1234'; |
|
54 | + $_POST['user_fname'] = 'Test User'; |
|
55 | + $errors = geodir_register_new_user( |
|
56 | + 'hello', |
|
57 | + '[email protected]' |
|
58 | + ); |
|
59 | + $errors = (array) $errors; |
|
60 | + $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
61 | + $this->assertContains( 'Passwords do not match', $errors["errors"]["pass_match"][0] ); |
|
62 | 62 | |
63 | - $_REQUEST['user_pass'] = '12345'; |
|
64 | - $_REQUEST['user_pass2'] = '12345'; |
|
65 | - $errors = geodir_register_new_user( |
|
66 | - 'hello', |
|
67 | - '[email protected]' |
|
68 | - ); |
|
69 | - $errors = (array) $errors; |
|
70 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
71 | - $this->assertContains( 'Password must be 7 characters or more', $errors["errors"]["pass_match"][0] ); |
|
72 | - } |
|
63 | + $_REQUEST['user_pass'] = '12345'; |
|
64 | + $_REQUEST['user_pass2'] = '12345'; |
|
65 | + $errors = geodir_register_new_user( |
|
66 | + 'hello', |
|
67 | + '[email protected]' |
|
68 | + ); |
|
69 | + $errors = (array) $errors; |
|
70 | + $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
71 | + $this->assertContains( 'Password must be 7 characters or more', $errors["errors"]["pass_match"][0] ); |
|
72 | + } |
|
73 | 73 | |
74 | - public function test_register_success() { |
|
75 | - $_POST['user_fname'] = 'Test User'; |
|
76 | - $data = geodir_register_new_user( |
|
77 | - 'hello', |
|
78 | - '[email protected]' |
|
79 | - ); |
|
80 | - $this->assertInternalType("int", $data[0]); |
|
81 | - } |
|
74 | + public function test_register_success() { |
|
75 | + $_POST['user_fname'] = 'Test User'; |
|
76 | + $data = geodir_register_new_user( |
|
77 | + 'hello', |
|
78 | + '[email protected]' |
|
79 | + ); |
|
80 | + $this->assertInternalType("int", $data[0]); |
|
81 | + } |
|
82 | 82 | |
83 | - public function testResetPassword() |
|
84 | - { |
|
85 | - global $errors; |
|
86 | - $_REQUEST['action'] = 'login'; |
|
87 | - $_POST['log'] = 'admin'; |
|
88 | - add_filter('wp_redirect', '__return_false'); |
|
89 | - geodir_user_signup(); |
|
90 | - remove_filter('wp_redirect', '__return_false'); |
|
91 | - $errors = (array) $errors; |
|
92 | - $this->assertArrayHasKey( 'empty_password', $errors["errors"] ); |
|
93 | - $this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] ); |
|
94 | - } |
|
83 | + public function testResetPassword() |
|
84 | + { |
|
85 | + global $errors; |
|
86 | + $_REQUEST['action'] = 'login'; |
|
87 | + $_POST['log'] = 'admin'; |
|
88 | + add_filter('wp_redirect', '__return_false'); |
|
89 | + geodir_user_signup(); |
|
90 | + remove_filter('wp_redirect', '__return_false'); |
|
91 | + $errors = (array) $errors; |
|
92 | + $this->assertArrayHasKey( 'empty_password', $errors["errors"] ); |
|
93 | + $this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] ); |
|
94 | + } |
|
95 | 95 | |
96 | - public function tearDown() |
|
97 | - { |
|
98 | - parent::tearDown(); |
|
99 | - } |
|
96 | + public function tearDown() |
|
97 | + { |
|
98 | + parent::tearDown(); |
|
99 | + } |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | ?> |
103 | 103 | \ No newline at end of file |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | '[email protected]' |
14 | 14 | ); |
15 | 15 | $errors = (array) $errors; |
16 | - $this->assertArrayHasKey( 'empty_username', $errors["errors"] ); |
|
17 | - $this->assertContains( 'Please enter a username', $errors["errors"]["empty_username"][0] ); |
|
16 | + $this->assertArrayHasKey('empty_username', $errors["errors"]); |
|
17 | + $this->assertContains('Please enter a username', $errors["errors"]["empty_username"][0]); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function test_register_invalid_username() { |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | '[email protected]' |
24 | 24 | ); |
25 | 25 | $errors = (array) $errors; |
26 | - $this->assertArrayHasKey( 'invalid_username', $errors["errors"] ); |
|
27 | - $this->assertContains( 'This username is invalid', $errors["errors"]["invalid_username"][0] ); |
|
26 | + $this->assertArrayHasKey('invalid_username', $errors["errors"]); |
|
27 | + $this->assertContains('This username is invalid', $errors["errors"]["invalid_username"][0]); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function test_register_invalid_email() { |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | 'hello@@hi.com' |
34 | 34 | ); |
35 | 35 | $errors = (array) $errors; |
36 | - $this->assertArrayHasKey( 'invalid_email', $errors["errors"] ); |
|
37 | - $this->assertContains( 'The email address isn’t correct', $errors["errors"]["invalid_email"][0] ); |
|
36 | + $this->assertArrayHasKey('invalid_email', $errors["errors"]); |
|
37 | + $this->assertContains('The email address isn’t correct', $errors["errors"]["invalid_email"][0]); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public function test_register_empty_email() { |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | '' |
44 | 44 | ); |
45 | 45 | $errors = (array) $errors; |
46 | - $this->assertArrayHasKey( 'empty_email', $errors["errors"] ); |
|
47 | - $this->assertContains( 'Please type your e-mail address', $errors["errors"]["empty_email"][0] ); |
|
46 | + $this->assertArrayHasKey('empty_email', $errors["errors"]); |
|
47 | + $this->assertContains('Please type your e-mail address', $errors["errors"]["empty_email"][0]); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function test_register_invalid_password() { |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | '[email protected]' |
58 | 58 | ); |
59 | 59 | $errors = (array) $errors; |
60 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
61 | - $this->assertContains( 'Passwords do not match', $errors["errors"]["pass_match"][0] ); |
|
60 | + $this->assertArrayHasKey('pass_match', $errors["errors"]); |
|
61 | + $this->assertContains('Passwords do not match', $errors["errors"]["pass_match"][0]); |
|
62 | 62 | |
63 | 63 | $_REQUEST['user_pass'] = '12345'; |
64 | 64 | $_REQUEST['user_pass2'] = '12345'; |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | '[email protected]' |
68 | 68 | ); |
69 | 69 | $errors = (array) $errors; |
70 | - $this->assertArrayHasKey( 'pass_match', $errors["errors"] ); |
|
71 | - $this->assertContains( 'Password must be 7 characters or more', $errors["errors"]["pass_match"][0] ); |
|
70 | + $this->assertArrayHasKey('pass_match', $errors["errors"]); |
|
71 | + $this->assertContains('Password must be 7 characters or more', $errors["errors"]["pass_match"][0]); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function test_register_success() { |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | geodir_user_signup(); |
90 | 90 | remove_filter('wp_redirect', '__return_false'); |
91 | 91 | $errors = (array) $errors; |
92 | - $this->assertArrayHasKey( 'empty_password', $errors["errors"] ); |
|
93 | - $this->assertContains( 'The password field is empty', $errors["errors"]["empty_password"][0] ); |
|
92 | + $this->assertArrayHasKey('empty_password', $errors["errors"]); |
|
93 | + $this->assertContains('The password field is empty', $errors["errors"]["empty_password"][0]); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | public function tearDown() |