@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | , $feedback |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | - $this->assertFalse( $valid ); |
|
| 35 | - $this->assertCount( 1, $feedback->messages['warning'] ); |
|
| 34 | + $this->assertFalse($valid); |
|
| 35 | + $this->assertCount(1, $feedback->messages['warning']); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $valid = wordpoints_importer_validate_points_type_setting( |
| 50 | 50 | true |
| 51 | - , array( 'points_type' => 'invalid' ) |
|
| 51 | + , array('points_type' => 'invalid') |
|
| 52 | 52 | , $feedback |
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | - $this->assertFalse( $valid ); |
|
| 56 | - $this->assertCount( 1, $feedback->messages['warning'] ); |
|
| 55 | + $this->assertFalse($valid); |
|
| 56 | + $this->assertCount(1, $feedback->messages['warning']); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | $valid = wordpoints_importer_validate_points_type_setting( |
| 71 | 71 | true |
| 72 | - , array( 'points_type' => 'points' ) |
|
| 72 | + , array('points_type' => 'points') |
|
| 73 | 73 | , $feedback |
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | - $this->assertTrue( $valid ); |
|
| 77 | - $this->assertEmpty( $feedback->messages ); |
|
| 76 | + $this->assertTrue($valid); |
|
| 77 | + $this->assertEmpty($feedback->messages); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $valid = wordpoints_importer_validate_points_type_setting( |
| 92 | 92 | false |
| 93 | - , array( 'points_type' => 'points' ) |
|
| 93 | + , array('points_type' => 'points') |
|
| 94 | 94 | , $feedback |
| 95 | 95 | ); |
| 96 | 96 | |
| 97 | - $this->assertFalse( $valid ); |
|
| 98 | - $this->assertEmpty( $feedback->messages ); |
|
| 97 | + $this->assertFalse($valid); |
|
| 98 | + $this->assertEmpty($feedback->messages); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | , $feedback |
| 118 | 118 | ); |
| 119 | 119 | |
| 120 | - $this->assertFalse( $valid ); |
|
| 121 | - $this->assertCount( 1, $feedback->messages['warning'] ); |
|
| 120 | + $this->assertFalse($valid); |
|
| 121 | + $this->assertCount(1, $feedback->messages['warning']); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | $valid = wordpoints_importer_validate_rank_group_setting( |
| 138 | 138 | true |
| 139 | - , array( 'rank_group' => 'invalid' ) |
|
| 139 | + , array('rank_group' => 'invalid') |
|
| 140 | 140 | , $feedback |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | - $this->assertFalse( $valid ); |
|
| 144 | - $this->assertCount( 1, $feedback->messages['warning'] ); |
|
| 143 | + $this->assertFalse($valid); |
|
| 144 | + $this->assertCount(1, $feedback->messages['warning']); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -159,12 +159,12 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | $valid = wordpoints_importer_validate_rank_group_setting( |
| 161 | 161 | true |
| 162 | - , array( 'rank_group' => 'points_type-points' ) |
|
| 162 | + , array('rank_group' => 'points_type-points') |
|
| 163 | 163 | , $feedback |
| 164 | 164 | ); |
| 165 | 165 | |
| 166 | - $this->assertTrue( $valid ); |
|
| 167 | - $this->assertEmpty( $feedback->messages ); |
|
| 166 | + $this->assertTrue($valid); |
|
| 167 | + $this->assertEmpty($feedback->messages); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -182,12 +182,12 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $valid = wordpoints_importer_validate_rank_group_setting( |
| 184 | 184 | false |
| 185 | - , array( 'rank_group' => 'points_type-points' ) |
|
| 185 | + , array('rank_group' => 'points_type-points') |
|
| 186 | 186 | , $feedback |
| 187 | 187 | ); |
| 188 | 188 | |
| 189 | - $this->assertFalse( $valid ); |
|
| 190 | - $this->assertEmpty( $feedback->messages ); |
|
| 189 | + $this->assertFalse($valid); |
|
| 190 | + $this->assertEmpty($feedback->messages); |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | // These are usually inactive by default. We activate them in the tests |
| 37 | 37 | // bootstrap so that they will be fully loaded, but deactivate them here to |
| 38 | 38 | // restore default behavior. |
| 39 | - cp_module_activation_set( 'post_author_points', false ); |
|
| 40 | - cp_module_activation_set( 'dailypoints', false ); |
|
| 39 | + cp_module_activation_set('post_author_points', false); |
|
| 40 | + cp_module_activation_set('dailypoints', false); |
|
| 41 | 41 | |
| 42 | - $this->importer = new WordPoints_CubePoints_Importer( 'Test CubePoints' ); |
|
| 42 | + $this->importer = new WordPoints_CubePoints_Importer('Test CubePoints'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function tearDown() { |
| 49 | 49 | |
| 50 | - WordPoints_Rank_Groups::deregister_group( 'points_type-points' ); |
|
| 51 | - WordPoints_Rank_Types::deregister_type( 'points-points' ); |
|
| 50 | + WordPoints_Rank_Groups::deregister_group('points_type-points'); |
|
| 51 | + WordPoints_Rank_Types::deregister_type('points-points'); |
|
| 52 | 52 | |
| 53 | 53 | parent::tearDown(); |
| 54 | 54 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function test_is_cubepoints_installed() { |
| 64 | 64 | |
| 65 | - $this->assertTrue( $this->importer->is_cubepoints_installed() ); |
|
| 65 | + $this->assertTrue($this->importer->is_cubepoints_installed()); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function test_is_cubepoints_not_installed() { |
| 76 | 76 | |
| 77 | - delete_option( 'cp_db_version' ); |
|
| 77 | + delete_option('cp_db_version'); |
|
| 78 | 78 | |
| 79 | - $this->assertFalse( $this->importer->is_cubepoints_installed() ); |
|
| 79 | + $this->assertFalse($this->importer->is_cubepoints_installed()); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function test_is_cubepoints_is_available() { |
| 90 | 90 | |
| 91 | - $this->assertTrue( $this->importer->is_available() ); |
|
| 91 | + $this->assertTrue($this->importer->is_available()); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function test_is_cubepoints_not_available() { |
| 102 | 102 | |
| 103 | - delete_option( 'cp_db_version' ); |
|
| 103 | + delete_option('cp_db_version'); |
|
| 104 | 104 | |
| 105 | - $this->assertWPError( $this->importer->is_available() ); |
|
| 105 | + $this->assertWPError($this->importer->is_available()); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | public function test_is_cubepoints_active() { |
| 116 | 116 | |
| 117 | 117 | $this->assertEquals( |
| 118 | - function_exists( 'cp_ready' ) |
|
| 118 | + function_exists('cp_ready') |
|
| 119 | 119 | , $this->importer->is_cubepoints_active() |
| 120 | 120 | ); |
| 121 | 121 | } |
@@ -129,20 +129,20 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function test_import_excluded_users() { |
| 131 | 131 | |
| 132 | - $user_ids = $this->factory->user->create_many( 3 ); |
|
| 132 | + $user_ids = $this->factory->user->create_many(3); |
|
| 133 | 133 | $user_logins = array(); |
| 134 | 134 | |
| 135 | - foreach ( $user_ids as $user_id ) { |
|
| 136 | - $user_logins[] = get_userdata( $user_id )->user_login; |
|
| 135 | + foreach ($user_ids as $user_id) { |
|
| 136 | + $user_logins[] = get_userdata($user_id)->user_login; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - update_option( 'cp_topfilter', $user_logins ); |
|
| 139 | + update_option('cp_topfilter', $user_logins); |
|
| 140 | 140 | |
| 141 | - $this->do_points_import( 'excluded_users' ); |
|
| 141 | + $this->do_points_import('excluded_users'); |
|
| 142 | 142 | |
| 143 | 143 | $this->assertEquals( |
| 144 | 144 | $user_ids |
| 145 | - , wordpoints_get_excluded_users( 'tests' ) |
|
| 145 | + , wordpoints_get_excluded_users('tests') |
|
| 146 | 146 | ); |
| 147 | 147 | } |
| 148 | 148 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function test_import_excluded_users_none() { |
| 157 | 157 | |
| 158 | - delete_option( 'cp_topfilter' ); |
|
| 158 | + delete_option('cp_topfilter'); |
|
| 159 | 159 | |
| 160 | 160 | $feedback = new WordPoints_Importer_Tests_Feedback(); |
| 161 | 161 | |
@@ -163,13 +163,13 @@ discard block |
||
| 163 | 163 | array( |
| 164 | 164 | 'points' => array( |
| 165 | 165 | 'excluded_users' => '1', |
| 166 | - '_data' => array( 'points_type' => 'points' ), |
|
| 166 | + '_data' => array('points_type' => 'points'), |
|
| 167 | 167 | ), |
| 168 | 168 | ) |
| 169 | 169 | , $feedback |
| 170 | 170 | ); |
| 171 | 171 | |
| 172 | - $this->assertCount( 1, $feedback->messages['warning'] ); |
|
| 172 | + $this->assertCount(1, $feedback->messages['warning']); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
@@ -183,16 +183,16 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public function test_import_points_settings() { |
| 185 | 185 | |
| 186 | - update_option( 'cp_comment_points', 10 ); |
|
| 187 | - update_option( 'cp_post_points', 20 ); |
|
| 188 | - update_option( 'cp_reg_points', 50 ); |
|
| 186 | + update_option('cp_comment_points', 10); |
|
| 187 | + update_option('cp_post_points', 20); |
|
| 188 | + update_option('cp_reg_points', 50); |
|
| 189 | 189 | |
| 190 | - $this->do_points_import( 'settings' ); |
|
| 190 | + $this->do_points_import('settings'); |
|
| 191 | 191 | |
| 192 | 192 | $this->assertHookImported( |
| 193 | 193 | array( |
| 194 | 194 | 'event' => 'comment_leave\post', |
| 195 | - 'target' => array( 'comment\post', 'author', 'user' ), |
|
| 195 | + 'target' => array('comment\post', 'author', 'user'), |
|
| 196 | 196 | 'reactor' => 'points_legacy', |
| 197 | 197 | 'points' => 10, |
| 198 | 198 | 'points_type' => 'points', |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | 'description' => 'Commenting on a Post.', |
| 201 | 201 | 'legacy_log_type' => 'cubepoints-comment', |
| 202 | 202 | 'legacy_meta_key' => 'comment', |
| 203 | - 'points_legacy_reversals' => array( 'toggle_off' => 'toggle_on' ), |
|
| 203 | + 'points_legacy_reversals' => array('toggle_off' => 'toggle_on'), |
|
| 204 | 204 | ) |
| 205 | 205 | ); |
| 206 | 206 | |
| 207 | 207 | $this->assertHookImported( |
| 208 | 208 | array( |
| 209 | 209 | 'event' => 'comment_leave\page', |
| 210 | - 'target' => array( 'comment\page', 'author', 'user' ), |
|
| 210 | + 'target' => array('comment\page', 'author', 'user'), |
|
| 211 | 211 | 'reactor' => 'points_legacy', |
| 212 | 212 | 'points' => 10, |
| 213 | 213 | 'points_type' => 'points', |
@@ -215,14 +215,14 @@ discard block |
||
| 215 | 215 | 'description' => 'Commenting on a Page.', |
| 216 | 216 | 'legacy_log_type' => 'cubepoints-comment', |
| 217 | 217 | 'legacy_meta_key' => 'comment', |
| 218 | - 'points_legacy_reversals' => array( 'toggle_off' => 'toggle_on' ), |
|
| 218 | + 'points_legacy_reversals' => array('toggle_off' => 'toggle_on'), |
|
| 219 | 219 | ) |
| 220 | 220 | ); |
| 221 | 221 | |
| 222 | 222 | $this->assertHookImported( |
| 223 | 223 | array( |
| 224 | 224 | 'event' => 'comment_leave\attachment', |
| 225 | - 'target' => array( 'comment\attachment', 'author', 'user' ), |
|
| 225 | + 'target' => array('comment\attachment', 'author', 'user'), |
|
| 226 | 226 | 'reactor' => 'points_legacy', |
| 227 | 227 | 'points' => 10, |
| 228 | 228 | 'points_type' => 'points', |
@@ -230,52 +230,52 @@ discard block |
||
| 230 | 230 | 'description' => 'Commenting on a Media.', |
| 231 | 231 | 'legacy_log_type' => 'cubepoints-comment', |
| 232 | 232 | 'legacy_meta_key' => 'comment', |
| 233 | - 'points_legacy_reversals' => array( 'toggle_off' => 'toggle_on' ), |
|
| 233 | + 'points_legacy_reversals' => array('toggle_off' => 'toggle_on'), |
|
| 234 | 234 | ) |
| 235 | 235 | ); |
| 236 | 236 | |
| 237 | 237 | $this->assertHookImported( |
| 238 | 238 | array( |
| 239 | 239 | 'event' => 'post_publish\post', |
| 240 | - 'target' => array( 'post\post', 'author', 'user' ), |
|
| 240 | + 'target' => array('post\post', 'author', 'user'), |
|
| 241 | 241 | 'reactor' => 'points_legacy', |
| 242 | 242 | 'points' => 20, |
| 243 | 243 | 'points_type' => 'points', |
| 244 | 244 | 'log_text' => 'Published a Post.', |
| 245 | 245 | 'description' => 'Publishing a Post.', |
| 246 | - 'blocker' => array( 'toggle_off' => true ), |
|
| 246 | + 'blocker' => array('toggle_off' => true), |
|
| 247 | 247 | 'legacy_log_type' => 'cubepoints-post', |
| 248 | 248 | 'legacy_meta_key' => 'post', |
| 249 | - 'points_legacy_reversals' => array( 'toggle_off' => 'toggle_on' ), |
|
| 250 | - 'points_legacy_repeat_blocker' => array( 'toggle_on' => true ), |
|
| 249 | + 'points_legacy_reversals' => array('toggle_off' => 'toggle_on'), |
|
| 250 | + 'points_legacy_repeat_blocker' => array('toggle_on' => true), |
|
| 251 | 251 | ) |
| 252 | 252 | ); |
| 253 | 253 | |
| 254 | - $reaction_store = wordpoints_hooks()->get_reaction_store( 'points' ); |
|
| 254 | + $reaction_store = wordpoints_hooks()->get_reaction_store('points'); |
|
| 255 | 255 | |
| 256 | 256 | $this->assertEmpty( |
| 257 | - $reaction_store->get_reactions_to_event( 'post_publish\page' ) |
|
| 257 | + $reaction_store->get_reactions_to_event('post_publish\page') |
|
| 258 | 258 | ); |
| 259 | 259 | |
| 260 | 260 | $this->assertEmpty( |
| 261 | - $reaction_store->get_reactions_to_event( 'post_publish\attachment' ) |
|
| 261 | + $reaction_store->get_reactions_to_event('post_publish\attachment') |
|
| 262 | 262 | ); |
| 263 | 263 | |
| 264 | 264 | $this->assertEmpty( |
| 265 | - $reaction_store->get_reactions_to_event( 'media_upload' ) |
|
| 265 | + $reaction_store->get_reactions_to_event('media_upload') |
|
| 266 | 266 | ); |
| 267 | 267 | |
| 268 | 268 | $this->assertHookImported( |
| 269 | 269 | array( |
| 270 | 270 | 'event' => 'user_register', |
| 271 | - 'target' => array( 'user' ), |
|
| 271 | + 'target' => array('user'), |
|
| 272 | 272 | 'reactor' => 'points_legacy', |
| 273 | 273 | 'points' => 50, |
| 274 | 274 | 'points_type' => 'points', |
| 275 | 275 | 'log_text' => 'Registration.', |
| 276 | 276 | 'description' => 'Registration.', |
| 277 | 277 | 'legacy_log_type' => 'cubepoints-register', |
| 278 | - 'points_legacy_reversals' => array( 'toggle_off' => 'toggle_on' ), |
|
| 278 | + 'points_legacy_reversals' => array('toggle_off' => 'toggle_on'), |
|
| 279 | 279 | ) |
| 280 | 280 | ); |
| 281 | 281 | } |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | public function test_imported_post_points_hook_does_not_refire() { |
| 291 | 291 | |
| 292 | - update_option( 'cp_post_points', 20 ); |
|
| 292 | + update_option('cp_post_points', 20); |
|
| 293 | 293 | |
| 294 | 294 | $user_id = $this->factory->user->create(); |
| 295 | 295 | $post_id = $this->factory->post->create( |
@@ -299,32 +299,32 @@ discard block |
||
| 299 | 299 | ) |
| 300 | 300 | ); |
| 301 | 301 | |
| 302 | - $this->assertEquals( 120, cp_getPoints( $user_id ) ); |
|
| 302 | + $this->assertEquals(120, cp_getPoints($user_id)); |
|
| 303 | 303 | |
| 304 | 304 | $this->factory->post->update_object( |
| 305 | 305 | $post_id |
| 306 | - , array( 'post_status' => 'draft' ) |
|
| 306 | + , array('post_status' => 'draft') |
|
| 307 | 307 | ); |
| 308 | 308 | |
| 309 | - $this->assertEquals( 120, cp_getPoints( $user_id ) ); |
|
| 309 | + $this->assertEquals(120, cp_getPoints($user_id)); |
|
| 310 | 310 | |
| 311 | - $this->do_points_import( 'settings' ); |
|
| 312 | - $this->do_points_import( 'user_points' ); |
|
| 313 | - $this->do_points_import( 'logs' ); |
|
| 311 | + $this->do_points_import('settings'); |
|
| 312 | + $this->do_points_import('user_points'); |
|
| 313 | + $this->do_points_import('logs'); |
|
| 314 | 314 | |
| 315 | 315 | $this->assertEquals( |
| 316 | 316 | 120 |
| 317 | - , wordpoints_get_points( $user_id, 'points' ) |
|
| 317 | + , wordpoints_get_points($user_id, 'points') |
|
| 318 | 318 | ); |
| 319 | 319 | |
| 320 | 320 | $this->factory->post->update_object( |
| 321 | 321 | $post_id |
| 322 | - , array( 'post_status' => 'publish' ) |
|
| 322 | + , array('post_status' => 'publish') |
|
| 323 | 323 | ); |
| 324 | 324 | |
| 325 | 325 | $this->assertEquals( |
| 326 | 326 | 120 |
| 327 | - , wordpoints_get_points( $user_id, 'points' ) |
|
| 327 | + , wordpoints_get_points($user_id, 'points') |
|
| 328 | 328 | ); |
| 329 | 329 | } |
| 330 | 330 | |
@@ -338,16 +338,16 @@ discard block |
||
| 338 | 338 | */ |
| 339 | 339 | public function test_import_post_author_points() { |
| 340 | 340 | |
| 341 | - cp_module_activation_set( 'post_author_points', 'active' ); |
|
| 341 | + cp_module_activation_set('post_author_points', 'active'); |
|
| 342 | 342 | |
| 343 | - update_option( 'cp_post_author_points', 15 ); |
|
| 343 | + update_option('cp_post_author_points', 15); |
|
| 344 | 344 | |
| 345 | - $this->do_points_import( 'settings' ); |
|
| 345 | + $this->do_points_import('settings'); |
|
| 346 | 346 | |
| 347 | 347 | $this->assertHookImported( |
| 348 | 348 | array( |
| 349 | 349 | 'event' => 'comment_leave\post', |
| 350 | - 'target' => array( 'comment\post', 'post\post', 'post\post', 'author', 'user' ), |
|
| 350 | + 'target' => array('comment\post', 'post\post', 'post\post', 'author', 'user'), |
|
| 351 | 351 | 'reactor' => 'points_legacy', |
| 352 | 352 | 'points' => 15, |
| 353 | 353 | 'points_type' => 'points', |
@@ -355,14 +355,14 @@ discard block |
||
| 355 | 355 | 'description' => 'Receiving a comment on a Post.', |
| 356 | 356 | 'legacy_log_type' => 'cubepoints-post_author', |
| 357 | 357 | 'legacy_meta_key' => 'comment', |
| 358 | - 'points_legacy_reversals' => array( 'toggle_off' => 'toggle_on' ), |
|
| 358 | + 'points_legacy_reversals' => array('toggle_off' => 'toggle_on'), |
|
| 359 | 359 | ) |
| 360 | 360 | ); |
| 361 | 361 | |
| 362 | 362 | $this->assertHookImported( |
| 363 | 363 | array( |
| 364 | 364 | 'event' => 'comment_leave\page', |
| 365 | - 'target' => array( 'comment\page', 'post\page', 'post\page', 'author', 'user' ), |
|
| 365 | + 'target' => array('comment\page', 'post\page', 'post\page', 'author', 'user'), |
|
| 366 | 366 | 'reactor' => 'points_legacy', |
| 367 | 367 | 'points' => 15, |
| 368 | 368 | 'points_type' => 'points', |
@@ -370,14 +370,14 @@ discard block |
||
| 370 | 370 | 'description' => 'Receiving a comment on a Page.', |
| 371 | 371 | 'legacy_log_type' => 'cubepoints-post_author', |
| 372 | 372 | 'legacy_meta_key' => 'comment', |
| 373 | - 'points_legacy_reversals' => array( 'toggle_off' => 'toggle_on' ), |
|
| 373 | + 'points_legacy_reversals' => array('toggle_off' => 'toggle_on'), |
|
| 374 | 374 | ) |
| 375 | 375 | ); |
| 376 | 376 | |
| 377 | 377 | $this->assertHookImported( |
| 378 | 378 | array( |
| 379 | 379 | 'event' => 'comment_leave\attachment', |
| 380 | - 'target' => array( 'comment\attachment', 'post\attachment', 'post\attachment', 'author', 'user' ), |
|
| 380 | + 'target' => array('comment\attachment', 'post\attachment', 'post\attachment', 'author', 'user'), |
|
| 381 | 381 | 'reactor' => 'points_legacy', |
| 382 | 382 | 'points' => 15, |
| 383 | 383 | 'points_type' => 'points', |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | 'description' => 'Receiving a comment on a Media.', |
| 386 | 386 | 'legacy_log_type' => 'cubepoints-post_author', |
| 387 | 387 | 'legacy_meta_key' => 'comment', |
| 388 | - 'points_legacy_reversals' => array( 'toggle_off' => 'toggle_on' ), |
|
| 388 | + 'points_legacy_reversals' => array('toggle_off' => 'toggle_on'), |
|
| 389 | 389 | ) |
| 390 | 390 | ); |
| 391 | 391 | } |
@@ -400,17 +400,17 @@ discard block |
||
| 400 | 400 | */ |
| 401 | 401 | public function test_import_periodic_points() { |
| 402 | 402 | |
| 403 | - cp_module_activation_set( 'dailypoints', 'active' ); |
|
| 403 | + cp_module_activation_set('dailypoints', 'active'); |
|
| 404 | 404 | |
| 405 | - update_option( 'cp_module_dailypoints_points', 30 ); |
|
| 406 | - update_option( 'cp_module_dailypoints_time', DAY_IN_SECONDS ); |
|
| 405 | + update_option('cp_module_dailypoints_points', 30); |
|
| 406 | + update_option('cp_module_dailypoints_time', DAY_IN_SECONDS); |
|
| 407 | 407 | |
| 408 | - $this->do_points_import( 'settings' ); |
|
| 408 | + $this->do_points_import('settings'); |
|
| 409 | 409 | |
| 410 | 410 | $this->assertHookImported( |
| 411 | 411 | array( |
| 412 | 412 | 'event' => 'user_visit', |
| 413 | - 'target' => array( 'current:user' ), |
|
| 413 | + 'target' => array('current:user'), |
|
| 414 | 414 | 'reactor' => 'points_legacy', |
| 415 | 415 | 'points' => 30, |
| 416 | 416 | 'points_type' => 'points', |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | 'fire' => array( |
| 421 | 421 | array( |
| 422 | 422 | 'length' => DAY_IN_SECONDS, |
| 423 | - 'args' => array( array( 'current:user' ) ), |
|
| 423 | + 'args' => array(array('current:user')), |
|
| 424 | 424 | 'relative' => true, |
| 425 | 425 | ), |
| 426 | 426 | ), |
@@ -441,39 +441,39 @@ discard block |
||
| 441 | 441 | */ |
| 442 | 442 | public function test_import_periodic_points_respect_old_periods() { |
| 443 | 443 | |
| 444 | - if ( version_compare( $GLOBALS['wp_version'], '4.5', '>=' ) ) { |
|
| 445 | - $this->setExpectedDeprecated( 'get_currentuserinfo' ); |
|
| 444 | + if (version_compare($GLOBALS['wp_version'], '4.5', '>=')) { |
|
| 445 | + $this->setExpectedDeprecated('get_currentuserinfo'); |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - cp_module_activation_set( 'dailypoints', 'active' ); |
|
| 448 | + cp_module_activation_set('dailypoints', 'active'); |
|
| 449 | 449 | |
| 450 | - update_option( 'cp_module_dailypoints_points', 30 ); |
|
| 451 | - update_option( 'cp_module_dailypoints_time', DAY_IN_SECONDS ); |
|
| 450 | + update_option('cp_module_dailypoints_points', 30); |
|
| 451 | + update_option('cp_module_dailypoints_time', DAY_IN_SECONDS); |
|
| 452 | 452 | |
| 453 | 453 | $user_id = $this->factory->user->create(); |
| 454 | 454 | |
| 455 | - wp_set_current_user( $user_id ); |
|
| 455 | + wp_set_current_user($user_id); |
|
| 456 | 456 | |
| 457 | - $this->assertEquals( 100, cp_getPoints( $user_id ) ); |
|
| 457 | + $this->assertEquals(100, cp_getPoints($user_id)); |
|
| 458 | 458 | |
| 459 | 459 | cp_module_dailypoints_checkTimer(); |
| 460 | 460 | |
| 461 | - $this->assertEquals( 130, cp_getPoints( $user_id ) ); |
|
| 461 | + $this->assertEquals(130, cp_getPoints($user_id)); |
|
| 462 | 462 | |
| 463 | 463 | // Running again shouldn't hit again. |
| 464 | 464 | cp_module_dailypoints_checkTimer(); |
| 465 | 465 | |
| 466 | - $this->assertEquals( 130, cp_getPoints( $user_id ) ); |
|
| 466 | + $this->assertEquals(130, cp_getPoints($user_id)); |
|
| 467 | 467 | |
| 468 | - $this->do_points_import( 'settings' ); |
|
| 469 | - $this->do_points_import( 'user_points' ); |
|
| 470 | - $this->do_points_import( 'logs' ); |
|
| 468 | + $this->do_points_import('settings'); |
|
| 469 | + $this->do_points_import('user_points'); |
|
| 470 | + $this->do_points_import('logs'); |
|
| 471 | 471 | |
| 472 | - $this->assertEquals( 130, wordpoints_get_points( $user_id, 'points' ) ); |
|
| 472 | + $this->assertEquals(130, wordpoints_get_points($user_id, 'points')); |
|
| 473 | 473 | |
| 474 | - wordpoints_hooks()->get_sub_app( 'router' )->{'wp,10'}(); |
|
| 474 | + wordpoints_hooks()->get_sub_app('router')->{'wp,10'}(); |
|
| 475 | 475 | |
| 476 | - $this->assertEquals( 130, wordpoints_get_points( $user_id, 'points' ) ); |
|
| 476 | + $this->assertEquals(130, wordpoints_get_points($user_id, 'points')); |
|
| 477 | 477 | |
| 478 | 478 | // Fast-forward and try again. |
| 479 | 479 | global $wpdb; |
@@ -490,40 +490,40 @@ discard block |
||
| 490 | 490 | // Don't go all the way yet. |
| 491 | 491 | $updated = $wpdb->update( |
| 492 | 492 | $wpdb->wordpoints_points_logs |
| 493 | - , array( 'date' => gmdate( 'Y-m-d H:i:s', current_time( 'timestamp', true ) - DAY_IN_SECONDS + HOUR_IN_SECONDS ) ) |
|
| 494 | - , array( 'id' => $id ) |
|
| 495 | - , array( '%s' ) |
|
| 496 | - , array( '%d' ) |
|
| 493 | + , array('date' => gmdate('Y-m-d H:i:s', current_time('timestamp', true) - DAY_IN_SECONDS + HOUR_IN_SECONDS)) |
|
| 494 | + , array('id' => $id) |
|
| 495 | + , array('%s') |
|
| 496 | + , array('%d') |
|
| 497 | 497 | ); |
| 498 | 498 | |
| 499 | - $this->assertEquals( 1, $updated ); |
|
| 499 | + $this->assertEquals(1, $updated); |
|
| 500 | 500 | |
| 501 | 501 | // The periods cache will still hold the old date. |
| 502 | 502 | $this->flush_cache(); |
| 503 | 503 | |
| 504 | - wordpoints_hooks()->get_sub_app( 'router' )->{'wp,10'}(); |
|
| 504 | + wordpoints_hooks()->get_sub_app('router')->{'wp,10'}(); |
|
| 505 | 505 | |
| 506 | 506 | // Points should have been awarded again yet. |
| 507 | - $this->assertEquals( 130, wordpoints_get_points( $user_id, 'points' ) ); |
|
| 507 | + $this->assertEquals(130, wordpoints_get_points($user_id, 'points')); |
|
| 508 | 508 | |
| 509 | 509 | // This time go all the way. |
| 510 | 510 | $updated = $wpdb->update( |
| 511 | 511 | $wpdb->wordpoints_points_logs |
| 512 | - , array( 'date' => gmdate( 'Y-m-d H:i:s', current_time( 'timestamp', true ) - DAY_IN_SECONDS - 1 ) ) |
|
| 513 | - , array( 'id' => $id ) |
|
| 514 | - , array( '%s' ) |
|
| 515 | - , array( '%d' ) |
|
| 512 | + , array('date' => gmdate('Y-m-d H:i:s', current_time('timestamp', true) - DAY_IN_SECONDS - 1)) |
|
| 513 | + , array('id' => $id) |
|
| 514 | + , array('%s') |
|
| 515 | + , array('%d') |
|
| 516 | 516 | ); |
| 517 | 517 | |
| 518 | - $this->assertEquals( 1, $updated ); |
|
| 518 | + $this->assertEquals(1, $updated); |
|
| 519 | 519 | |
| 520 | 520 | // The periods cache will still hold the old date. |
| 521 | 521 | $this->flush_cache(); |
| 522 | 522 | |
| 523 | - wordpoints_hooks()->get_sub_app( 'router' )->{'wp,10'}(); |
|
| 523 | + wordpoints_hooks()->get_sub_app('router')->{'wp,10'}(); |
|
| 524 | 524 | |
| 525 | 525 | // Points should have been awarded again. |
| 526 | - $this->assertEquals( 160, wordpoints_get_points( $user_id, 'points' ) ); |
|
| 526 | + $this->assertEquals(160, wordpoints_get_points($user_id, 'points')); |
|
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | /** |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | */ |
| 537 | 537 | public function test_import_periods_positive_gmt_offset() { |
| 538 | 538 | |
| 539 | - update_option( 'gmt_offset', 5 ); |
|
| 539 | + update_option('gmt_offset', 5); |
|
| 540 | 540 | |
| 541 | 541 | $this->test_import_periodic_points_respect_old_periods(); |
| 542 | 542 | } |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | */ |
| 552 | 552 | public function test_import_periods_negative_gmt_offset() { |
| 553 | 553 | |
| 554 | - update_option( 'gmt_offset', -5 ); |
|
| 554 | + update_option('gmt_offset', -5); |
|
| 555 | 555 | |
| 556 | 556 | $this->test_import_periodic_points_respect_old_periods(); |
| 557 | 557 | } |
@@ -568,17 +568,17 @@ discard block |
||
| 568 | 568 | |
| 569 | 569 | $user_points = array(); |
| 570 | 570 | |
| 571 | - foreach ( array( 20, 10, 45 ) as $points ) { |
|
| 571 | + foreach (array(20, 10, 45) as $points) { |
|
| 572 | 572 | |
| 573 | 573 | $user_id = $this->factory->user->create(); |
| 574 | - cp_updatePoints( $user_id, $points ); |
|
| 575 | - $user_points[ $user_id ] = $points; |
|
| 574 | + cp_updatePoints($user_id, $points); |
|
| 575 | + $user_points[$user_id] = $points; |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | - $this->do_points_import( 'user_points' ); |
|
| 578 | + $this->do_points_import('user_points'); |
|
| 579 | 579 | |
| 580 | - foreach ( $user_points as $user_id => $points ) { |
|
| 581 | - $this->assertEquals( $points, wordpoints_get_points( $user_id, 'points' ) ); |
|
| 580 | + foreach ($user_points as $user_id => $points) { |
|
| 581 | + $this->assertEquals($points, wordpoints_get_points($user_id, 'points')); |
|
| 582 | 582 | } |
| 583 | 583 | } |
| 584 | 584 | |
@@ -594,42 +594,42 @@ discard block |
||
| 594 | 594 | */ |
| 595 | 595 | public function test_import_points_logs() { |
| 596 | 596 | |
| 597 | - remove_action( 'publish_post', 'cp_newPost' ); |
|
| 597 | + remove_action('publish_post', 'cp_newPost'); |
|
| 598 | 598 | |
| 599 | 599 | $user_id = $this->factory->user->create(); |
| 600 | - cp_points( 'misc', $user_id, 10, 'Testing things.' ); |
|
| 600 | + cp_points('misc', $user_id, 10, 'Testing things.'); |
|
| 601 | 601 | |
| 602 | 602 | $user_id_2 = $this->factory->user->create(); |
| 603 | 603 | $post_id = $this->factory->post->create(); |
| 604 | - cp_points( 'post', $user_id_2, 25, $post_id ); |
|
| 604 | + cp_points('post', $user_id_2, 25, $post_id); |
|
| 605 | 605 | |
| 606 | - $this->do_points_import( 'logs' ); |
|
| 606 | + $this->do_points_import('logs'); |
|
| 607 | 607 | |
| 608 | - $query = new WordPoints_Points_Logs_Query( array( 'orderby' => 'id' ) ); |
|
| 608 | + $query = new WordPoints_Points_Logs_Query(array('orderby' => 'id')); |
|
| 609 | 609 | $logs = $query->get(); |
| 610 | 610 | |
| 611 | - $this->assertCount( 4, $logs ); |
|
| 611 | + $this->assertCount(4, $logs); |
|
| 612 | 612 | |
| 613 | 613 | $log = $logs[2]; |
| 614 | 614 | |
| 615 | - $this->assertEquals( $user_id, $log->user_id ); |
|
| 616 | - $this->assertEquals( 10, $log->points ); |
|
| 617 | - $this->assertEquals( 'Testing things.', $log->text ); |
|
| 618 | - $this->assertEquals( 'cubepoints-misc', $log->log_type ); |
|
| 619 | - $this->assertEquals( 'points', $log->points_type ); |
|
| 620 | - $this->assertEquals( 'misc', wordpoints_get_points_log_meta( $log->id, 'cubepoints_type', true ) ); |
|
| 621 | - $this->assertEquals( 'Testing things.', wordpoints_get_points_log_meta( $log->id, 'cubepoints_data', true ) ); |
|
| 615 | + $this->assertEquals($user_id, $log->user_id); |
|
| 616 | + $this->assertEquals(10, $log->points); |
|
| 617 | + $this->assertEquals('Testing things.', $log->text); |
|
| 618 | + $this->assertEquals('cubepoints-misc', $log->log_type); |
|
| 619 | + $this->assertEquals('points', $log->points_type); |
|
| 620 | + $this->assertEquals('misc', wordpoints_get_points_log_meta($log->id, 'cubepoints_type', true)); |
|
| 621 | + $this->assertEquals('Testing things.', wordpoints_get_points_log_meta($log->id, 'cubepoints_data', true)); |
|
| 622 | 622 | |
| 623 | 623 | $log = $logs[0]; |
| 624 | 624 | |
| 625 | - $this->assertEquals( $user_id_2, $log->user_id ); |
|
| 626 | - $this->assertEquals( 25, $log->points ); |
|
| 627 | - $this->assertStringMatchesFormat( 'Post on "<a href="%s">Post title %s</a>"', $log->text ); |
|
| 628 | - $this->assertEquals( 'cubepoints-post', $log->log_type ); |
|
| 629 | - $this->assertEquals( 'points', $log->points_type ); |
|
| 630 | - $this->assertEquals( 'post', wordpoints_get_points_log_meta( $log->id, 'cubepoints_type', true ) ); |
|
| 631 | - $this->assertEquals( $post_id, wordpoints_get_points_log_meta( $log->id, 'cubepoints_data', true ) ); |
|
| 632 | - $this->assertEquals( $post_id, wordpoints_get_points_log_meta( $log->id, 'post', true ) ); |
|
| 625 | + $this->assertEquals($user_id_2, $log->user_id); |
|
| 626 | + $this->assertEquals(25, $log->points); |
|
| 627 | + $this->assertStringMatchesFormat('Post on "<a href="%s">Post title %s</a>"', $log->text); |
|
| 628 | + $this->assertEquals('cubepoints-post', $log->log_type); |
|
| 629 | + $this->assertEquals('points', $log->points_type); |
|
| 630 | + $this->assertEquals('post', wordpoints_get_points_log_meta($log->id, 'cubepoints_type', true)); |
|
| 631 | + $this->assertEquals($post_id, wordpoints_get_points_log_meta($log->id, 'cubepoints_data', true)); |
|
| 632 | + $this->assertEquals($post_id, wordpoints_get_points_log_meta($log->id, 'post', true)); |
|
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | /** |
@@ -644,97 +644,97 @@ discard block |
||
| 644 | 644 | */ |
| 645 | 645 | public function test_import_points_logs_reversals() { |
| 646 | 646 | |
| 647 | - remove_action( 'publish_post', 'cp_newPost' ); |
|
| 648 | - remove_action( 'cp_comment_add', 'cp_module_post_author_points_comment_add' ); |
|
| 649 | - remove_action( 'cp_comment_remove', 'cp_module_post_author_points_comment_remove' ); |
|
| 647 | + remove_action('publish_post', 'cp_newPost'); |
|
| 648 | + remove_action('cp_comment_add', 'cp_module_post_author_points_comment_add'); |
|
| 649 | + remove_action('cp_comment_remove', 'cp_module_post_author_points_comment_remove'); |
|
| 650 | 650 | |
| 651 | - update_option( 'cp_comment_points', 10 ); |
|
| 652 | - update_option( 'cp_del_comment_points', 10 ); |
|
| 651 | + update_option('cp_comment_points', 10); |
|
| 652 | + update_option('cp_del_comment_points', 10); |
|
| 653 | 653 | |
| 654 | 654 | $user_id = $this->factory->user->create(); |
| 655 | 655 | $post_id = $this->factory->post->create(); |
| 656 | 656 | |
| 657 | 657 | $comment_id = $this->factory->comment->create( |
| 658 | - array( 'user_id' => $user_id, 'comment_post_ID' => $post_id, 'comment_approved' => 0 ) |
|
| 658 | + array('user_id' => $user_id, 'comment_post_ID' => $post_id, 'comment_approved' => 0) |
|
| 659 | 659 | ); |
| 660 | 660 | |
| 661 | 661 | wp_update_comment( |
| 662 | - array( 'comment_ID' => $comment_id, 'comment_approved' => 1 ) |
|
| 662 | + array('comment_ID' => $comment_id, 'comment_approved' => 1) |
|
| 663 | 663 | ); |
| 664 | 664 | |
| 665 | 665 | $user_id_2 = $this->factory->user->create(); |
| 666 | 666 | $comment_id_2 = $this->factory->comment->create( |
| 667 | - array( 'user_id' => $user_id_2, 'comment_post_ID' => $post_id, 'comment_approved' => 0 ) |
|
| 667 | + array('user_id' => $user_id_2, 'comment_post_ID' => $post_id, 'comment_approved' => 0) |
|
| 668 | 668 | ); |
| 669 | 669 | |
| 670 | 670 | wp_update_comment( |
| 671 | - array( 'comment_ID' => $comment_id_2, 'comment_approved' => 1 ) |
|
| 671 | + array('comment_ID' => $comment_id_2, 'comment_approved' => 1) |
|
| 672 | 672 | ); |
| 673 | 673 | |
| 674 | 674 | // Now reverse the two transactions. |
| 675 | 675 | wp_update_comment( |
| 676 | - array( 'comment_ID' => $comment_id, 'comment_approved' => 0 ) |
|
| 676 | + array('comment_ID' => $comment_id, 'comment_approved' => 0) |
|
| 677 | 677 | ); |
| 678 | 678 | |
| 679 | 679 | wp_update_comment( |
| 680 | - array( 'comment_ID' => $comment_id_2, 'comment_approved' => 0 ) |
|
| 680 | + array('comment_ID' => $comment_id_2, 'comment_approved' => 0) |
|
| 681 | 681 | ); |
| 682 | 682 | |
| 683 | - $this->do_points_import( 'logs' ); |
|
| 683 | + $this->do_points_import('logs'); |
|
| 684 | 684 | |
| 685 | 685 | $query = new WordPoints_Points_Logs_Query( |
| 686 | - array( 'orderby' => 'id', 'order' => 'ASC' ) |
|
| 686 | + array('orderby' => 'id', 'order' => 'ASC') |
|
| 687 | 687 | ); |
| 688 | 688 | |
| 689 | 689 | $logs = $query->get(); |
| 690 | 690 | |
| 691 | - $this->assertCount( 6, $logs ); |
|
| 691 | + $this->assertCount(6, $logs); |
|
| 692 | 692 | |
| 693 | 693 | // The first log will be for when the first user was created, so we skip it. |
| 694 | 694 | $log = $logs[1]; |
| 695 | 695 | |
| 696 | - $this->assertEquals( $user_id, $log->user_id ); |
|
| 697 | - $this->assertEquals( 10, $log->points ); |
|
| 698 | - $this->assertEquals( 'cubepoints-comment', $log->log_type ); |
|
| 699 | - $this->assertEquals( 'points', $log->points_type ); |
|
| 700 | - $this->assertEquals( 'comment', wordpoints_get_points_log_meta( $log->id, 'cubepoints_type', true ) ); |
|
| 701 | - $this->assertEquals( $comment_id, wordpoints_get_points_log_meta( $log->id, 'cubepoints_data', true ) ); |
|
| 702 | - $this->assertEquals( $comment_id, wordpoints_get_points_log_meta( $log->id, 'comment', true ) ); |
|
| 703 | - $this->assertEquals( $logs[4]->id, wordpoints_get_points_log_meta( $log->id, 'auto_reversed', true ) ); |
|
| 696 | + $this->assertEquals($user_id, $log->user_id); |
|
| 697 | + $this->assertEquals(10, $log->points); |
|
| 698 | + $this->assertEquals('cubepoints-comment', $log->log_type); |
|
| 699 | + $this->assertEquals('points', $log->points_type); |
|
| 700 | + $this->assertEquals('comment', wordpoints_get_points_log_meta($log->id, 'cubepoints_type', true)); |
|
| 701 | + $this->assertEquals($comment_id, wordpoints_get_points_log_meta($log->id, 'cubepoints_data', true)); |
|
| 702 | + $this->assertEquals($comment_id, wordpoints_get_points_log_meta($log->id, 'comment', true)); |
|
| 703 | + $this->assertEquals($logs[4]->id, wordpoints_get_points_log_meta($log->id, 'auto_reversed', true)); |
|
| 704 | 704 | |
| 705 | 705 | // The third log is for when the second user was created, so we skip it, too. |
| 706 | 706 | $log = $logs[3]; |
| 707 | 707 | |
| 708 | - $this->assertEquals( $user_id_2, $log->user_id ); |
|
| 709 | - $this->assertEquals( 10, $log->points ); |
|
| 710 | - $this->assertEquals( 'cubepoints-comment', $log->log_type ); |
|
| 711 | - $this->assertEquals( 'points', $log->points_type ); |
|
| 712 | - $this->assertEquals( 'comment', wordpoints_get_points_log_meta( $log->id, 'cubepoints_type', true ) ); |
|
| 713 | - $this->assertEquals( $comment_id_2, wordpoints_get_points_log_meta( $log->id, 'cubepoints_data', true ) ); |
|
| 714 | - $this->assertEquals( $comment_id_2, wordpoints_get_points_log_meta( $log->id, 'comment', true ) ); |
|
| 715 | - $this->assertEquals( $logs[5]->id, wordpoints_get_points_log_meta( $log->id, 'auto_reversed', true ) ); |
|
| 708 | + $this->assertEquals($user_id_2, $log->user_id); |
|
| 709 | + $this->assertEquals(10, $log->points); |
|
| 710 | + $this->assertEquals('cubepoints-comment', $log->log_type); |
|
| 711 | + $this->assertEquals('points', $log->points_type); |
|
| 712 | + $this->assertEquals('comment', wordpoints_get_points_log_meta($log->id, 'cubepoints_type', true)); |
|
| 713 | + $this->assertEquals($comment_id_2, wordpoints_get_points_log_meta($log->id, 'cubepoints_data', true)); |
|
| 714 | + $this->assertEquals($comment_id_2, wordpoints_get_points_log_meta($log->id, 'comment', true)); |
|
| 715 | + $this->assertEquals($logs[5]->id, wordpoints_get_points_log_meta($log->id, 'auto_reversed', true)); |
|
| 716 | 716 | |
| 717 | 717 | $log = $logs[4]; |
| 718 | 718 | |
| 719 | - $this->assertEquals( $user_id, $log->user_id ); |
|
| 719 | + $this->assertEquals($user_id, $log->user_id); |
|
| 720 | 720 | $this->assertEquals( -10, $log->points ); |
| 721 | - $this->assertEquals( 'cubepoints-comment_remove', $log->log_type ); |
|
| 722 | - $this->assertEquals( 'points', $log->points_type ); |
|
| 723 | - $this->assertEquals( 'comment_remove', wordpoints_get_points_log_meta( $log->id, 'cubepoints_type', true ) ); |
|
| 724 | - $this->assertEquals( $comment_id, wordpoints_get_points_log_meta( $log->id, 'cubepoints_data', true ) ); |
|
| 725 | - $this->assertEquals( $comment_id, wordpoints_get_points_log_meta( $log->id, 'comment', true ) ); |
|
| 726 | - $this->assertEquals( $logs[1]->id, wordpoints_get_points_log_meta( $log->id, 'original_log_id', true ) ); |
|
| 721 | + $this->assertEquals('cubepoints-comment_remove', $log->log_type); |
|
| 722 | + $this->assertEquals('points', $log->points_type); |
|
| 723 | + $this->assertEquals('comment_remove', wordpoints_get_points_log_meta($log->id, 'cubepoints_type', true)); |
|
| 724 | + $this->assertEquals($comment_id, wordpoints_get_points_log_meta($log->id, 'cubepoints_data', true)); |
|
| 725 | + $this->assertEquals($comment_id, wordpoints_get_points_log_meta($log->id, 'comment', true)); |
|
| 726 | + $this->assertEquals($logs[1]->id, wordpoints_get_points_log_meta($log->id, 'original_log_id', true)); |
|
| 727 | 727 | |
| 728 | 728 | $log = $logs[5]; |
| 729 | 729 | |
| 730 | - $this->assertEquals( $user_id_2, $log->user_id ); |
|
| 730 | + $this->assertEquals($user_id_2, $log->user_id); |
|
| 731 | 731 | $this->assertEquals( -10, $log->points ); |
| 732 | - $this->assertEquals( 'cubepoints-comment_remove', $log->log_type ); |
|
| 733 | - $this->assertEquals( 'points', $log->points_type ); |
|
| 734 | - $this->assertEquals( 'comment_remove', wordpoints_get_points_log_meta( $log->id, 'cubepoints_type', true ) ); |
|
| 735 | - $this->assertEquals( $comment_id_2, wordpoints_get_points_log_meta( $log->id, 'cubepoints_data', true ) ); |
|
| 736 | - $this->assertEquals( $comment_id_2, wordpoints_get_points_log_meta( $log->id, 'comment', true ) ); |
|
| 737 | - $this->assertEquals( $logs[3]->id, wordpoints_get_points_log_meta( $log->id, 'original_log_id', true ) ); |
|
| 732 | + $this->assertEquals('cubepoints-comment_remove', $log->log_type); |
|
| 733 | + $this->assertEquals('points', $log->points_type); |
|
| 734 | + $this->assertEquals('comment_remove', wordpoints_get_points_log_meta($log->id, 'cubepoints_type', true)); |
|
| 735 | + $this->assertEquals($comment_id_2, wordpoints_get_points_log_meta($log->id, 'cubepoints_data', true)); |
|
| 736 | + $this->assertEquals($comment_id_2, wordpoints_get_points_log_meta($log->id, 'comment', true)); |
|
| 737 | + $this->assertEquals($logs[3]->id, wordpoints_get_points_log_meta($log->id, 'original_log_id', true)); |
|
| 738 | 738 | } |
| 739 | 739 | |
| 740 | 740 | /** |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | |
| 749 | 749 | update_option( |
| 750 | 750 | 'cp_module_ranks_data' |
| 751 | - , array( 0 => 'Newbie', 1000 => 'Biggie', 5000 => 'Oldie' ) |
|
| 751 | + , array(0 => 'Newbie', 1000 => 'Biggie', 5000 => 'Oldie') |
|
| 752 | 752 | ); |
| 753 | 753 | |
| 754 | 754 | wordpoints_register_points_ranks(); |
@@ -759,28 +759,28 @@ discard block |
||
| 759 | 759 | array( |
| 760 | 760 | 'ranks' => array( |
| 761 | 761 | 'ranks' => '1', |
| 762 | - '_data' => array( 'rank_group' => 'points_type-points' ), |
|
| 762 | + '_data' => array('rank_group' => 'points_type-points'), |
|
| 763 | 763 | ), |
| 764 | 764 | ) |
| 765 | 765 | , $feedback |
| 766 | 766 | ); |
| 767 | 767 | |
| 768 | - $this->assertCount( 4, $feedback->messages['info'] ); |
|
| 769 | - $this->assertCount( 1, $feedback->messages['success'] ); |
|
| 768 | + $this->assertCount(4, $feedback->messages['info']); |
|
| 769 | + $this->assertCount(1, $feedback->messages['success']); |
|
| 770 | 770 | |
| 771 | - $group = WordPoints_Rank_Groups::get_group( 'points_type-points' ); |
|
| 771 | + $group = WordPoints_Rank_Groups::get_group('points_type-points'); |
|
| 772 | 772 | |
| 773 | - $base_rank = wordpoints_get_rank( $group->get_rank( 0 ) ); |
|
| 774 | - $this->assertEquals( 'base', $base_rank->type ); |
|
| 775 | - $this->assertEquals( 'Newbie', $base_rank->name ); |
|
| 773 | + $base_rank = wordpoints_get_rank($group->get_rank(0)); |
|
| 774 | + $this->assertEquals('base', $base_rank->type); |
|
| 775 | + $this->assertEquals('Newbie', $base_rank->name); |
|
| 776 | 776 | |
| 777 | - $second_rank = wordpoints_get_rank( $group->get_rank( 1 ) ); |
|
| 778 | - $this->assertEquals( 1000, $second_rank->points ); |
|
| 779 | - $this->assertEquals( 'Biggie', $second_rank->name ); |
|
| 777 | + $second_rank = wordpoints_get_rank($group->get_rank(1)); |
|
| 778 | + $this->assertEquals(1000, $second_rank->points); |
|
| 779 | + $this->assertEquals('Biggie', $second_rank->name); |
|
| 780 | 780 | |
| 781 | - $third_rank = wordpoints_get_rank( $group->get_rank( 2 ) ); |
|
| 782 | - $this->assertEquals( 5000, $third_rank->points ); |
|
| 783 | - $this->assertEquals( 'Oldie', $third_rank->name ); |
|
| 781 | + $third_rank = wordpoints_get_rank($group->get_rank(2)); |
|
| 782 | + $this->assertEquals(5000, $third_rank->points); |
|
| 783 | + $this->assertEquals('Oldie', $third_rank->name); |
|
| 784 | 784 | } |
| 785 | 785 | |
| 786 | 786 | /** |
@@ -800,14 +800,14 @@ discard block |
||
| 800 | 800 | array( |
| 801 | 801 | 'ranks' => array( |
| 802 | 802 | 'ranks' => '1', |
| 803 | - '_data' => array( 'rank_group' => 'points_type-points' ), |
|
| 803 | + '_data' => array('rank_group' => 'points_type-points'), |
|
| 804 | 804 | ), |
| 805 | 805 | ) |
| 806 | 806 | , $feedback |
| 807 | 807 | ); |
| 808 | 808 | |
| 809 | - $this->assertCount( 4, $feedback->messages['info'] ); |
|
| 810 | - $this->assertCount( 1, $feedback->messages['error'] ); |
|
| 809 | + $this->assertCount(4, $feedback->messages['info']); |
|
| 810 | + $this->assertCount(1, $feedback->messages['error']); |
|
| 811 | 811 | |
| 812 | 812 | } |
| 813 | 813 | |
@@ -822,7 +822,7 @@ discard block |
||
| 822 | 822 | * |
| 823 | 823 | * @param string $type The type of points import. |
| 824 | 824 | */ |
| 825 | - protected function do_points_import( $type ) { |
|
| 825 | + protected function do_points_import($type) { |
|
| 826 | 826 | |
| 827 | 827 | $feedback = new WordPoints_Importer_Tests_Feedback(); |
| 828 | 828 | |
@@ -830,14 +830,14 @@ discard block |
||
| 830 | 830 | array( |
| 831 | 831 | 'points' => array( |
| 832 | 832 | $type => '1', |
| 833 | - '_data' => array( 'points_type' => 'points' ), |
|
| 833 | + '_data' => array('points_type' => 'points'), |
|
| 834 | 834 | ), |
| 835 | 835 | ) |
| 836 | 836 | , $feedback |
| 837 | 837 | ); |
| 838 | 838 | |
| 839 | - $this->assertCount( 4, $feedback->messages['info'] ); |
|
| 840 | - $this->assertCount( 1, $feedback->messages['success'] ); |
|
| 839 | + $this->assertCount(4, $feedback->messages['info']); |
|
| 840 | + $this->assertCount(1, $feedback->messages['success']); |
|
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | /** |
@@ -850,22 +850,22 @@ discard block |
||
| 850 | 850 | * |
| 851 | 851 | * @param array $settings The expected reaction settings. |
| 852 | 852 | */ |
| 853 | - protected function assertHookImported( $settings ) { |
|
| 853 | + protected function assertHookImported($settings) { |
|
| 854 | 854 | |
| 855 | - $reaction_store = wordpoints_hooks()->get_reaction_store( 'points' ); |
|
| 855 | + $reaction_store = wordpoints_hooks()->get_reaction_store('points'); |
|
| 856 | 856 | |
| 857 | - $reactions = $reaction_store->get_reactions_to_event( $settings['event'] ); |
|
| 857 | + $reactions = $reaction_store->get_reactions_to_event($settings['event']); |
|
| 858 | 858 | |
| 859 | - $this->assertNotEmpty( $reactions ); |
|
| 859 | + $this->assertNotEmpty($reactions); |
|
| 860 | 860 | |
| 861 | - foreach ( $reactions as $reaction ) { |
|
| 862 | - if ( $settings === $reaction->get_all_meta() ) { |
|
| 863 | - $this->assertEquals( $settings, $reaction->get_all_meta() ); |
|
| 861 | + foreach ($reactions as $reaction) { |
|
| 862 | + if ($settings === $reaction->get_all_meta()) { |
|
| 863 | + $this->assertEquals($settings, $reaction->get_all_meta()); |
|
| 864 | 864 | return; |
| 865 | 865 | } |
| 866 | 866 | } |
| 867 | 867 | |
| 868 | - $this->assertEquals( $settings, $reaction->get_all_meta() ); |
|
| 868 | + $this->assertEquals($settings, $reaction->get_all_meta()); |
|
| 869 | 869 | } |
| 870 | 870 | } |
| 871 | 871 | |
@@ -30,24 +30,24 @@ |
||
| 30 | 30 | * |
| 31 | 31 | * @dataProvider data_provider_types |
| 32 | 32 | */ |
| 33 | - public function test( $type ) { |
|
| 33 | + public function test($type) { |
|
| 34 | 34 | |
| 35 | - $this->before( $type ); |
|
| 35 | + $this->before($type); |
|
| 36 | 36 | |
| 37 | 37 | $user_id = $this->factory->user->create(); |
| 38 | 38 | $post_id = $this->factory->post->create( |
| 39 | - array( 'post_author' => $user_id, 'post_status' => 'publish' ) |
|
| 39 | + array('post_author' => $user_id, 'post_status' => 'publish') |
|
| 40 | 40 | ); |
| 41 | 41 | |
| 42 | - $this->assertEquals( 10, $this->get_user_points( $user_id ) ); |
|
| 42 | + $this->assertEquals(10, $this->get_user_points($user_id)); |
|
| 43 | 43 | |
| 44 | - wp_update_post( array( 'ID' => $post_id, 'post_status' => 'draft' ) ); |
|
| 44 | + wp_update_post(array('ID' => $post_id, 'post_status' => 'draft')); |
|
| 45 | 45 | |
| 46 | - $this->assertEquals( 10, $this->get_user_points( $user_id ) ); |
|
| 46 | + $this->assertEquals(10, $this->get_user_points($user_id)); |
|
| 47 | 47 | |
| 48 | - wp_delete_post( $post_id, true ); |
|
| 48 | + wp_delete_post($post_id, true); |
|
| 49 | 49 | |
| 50 | - $this->assertEquals( 10, $this->get_user_points( $user_id ) ); |
|
| 50 | + $this->assertEquals(10, $this->get_user_points($user_id)); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
@@ -30,15 +30,15 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @dataProvider data_provider_types |
| 32 | 32 | */ |
| 33 | - public function test( $type ) { |
|
| 33 | + public function test($type) { |
|
| 34 | 34 | |
| 35 | - $this->before( $type ); |
|
| 35 | + $this->before($type); |
|
| 36 | 36 | |
| 37 | - update_option( 'cp_del_comment_points', 10 ); |
|
| 37 | + update_option('cp_del_comment_points', 10); |
|
| 38 | 38 | |
| 39 | 39 | $user_id = $this->factory->user->create(); |
| 40 | 40 | $post_id = $this->factory->post->create( |
| 41 | - array( 'post_author' => $this->factory->user->create() ) |
|
| 41 | + array('post_author' => $this->factory->user->create()) |
|
| 42 | 42 | ); |
| 43 | 43 | |
| 44 | 44 | $comment_id = $this->factory->comment->create( |
@@ -49,19 +49,19 @@ discard block |
||
| 49 | 49 | ) |
| 50 | 50 | ); |
| 51 | 51 | |
| 52 | - $this->assertEquals( 0, $this->get_user_points( $user_id ) ); |
|
| 52 | + $this->assertEquals(0, $this->get_user_points($user_id)); |
|
| 53 | 53 | |
| 54 | 54 | wp_update_comment( |
| 55 | - array( 'comment_ID' => $comment_id, 'comment_approved' => 1 ) |
|
| 55 | + array('comment_ID' => $comment_id, 'comment_approved' => 1) |
|
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | - $this->assertEquals( 10, $this->get_user_points( $user_id ) ); |
|
| 58 | + $this->assertEquals(10, $this->get_user_points($user_id)); |
|
| 59 | 59 | |
| 60 | 60 | wp_update_comment( |
| 61 | - array( 'comment_ID' => $comment_id, 'comment_approved' => 0 ) |
|
| 61 | + array('comment_ID' => $comment_id, 'comment_approved' => 0) |
|
| 62 | 62 | ); |
| 63 | 63 | |
| 64 | - $this->assertEquals( 0, $this->get_user_points( $user_id ) ); |
|
| 64 | + $this->assertEquals(0, $this->get_user_points($user_id)); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
@@ -30,17 +30,17 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @dataProvider data_provider_types |
| 32 | 32 | */ |
| 33 | - public function test( $type ) { |
|
| 33 | + public function test($type) { |
|
| 34 | 34 | |
| 35 | - cp_module_activation_set( 'post_author_points', 'active' ); |
|
| 35 | + cp_module_activation_set('post_author_points', 'active'); |
|
| 36 | 36 | |
| 37 | - update_option( 'cp_post_points', 0 ); |
|
| 37 | + update_option('cp_post_points', 0); |
|
| 38 | 38 | |
| 39 | - $this->before( $type ); |
|
| 39 | + $this->before($type); |
|
| 40 | 40 | |
| 41 | 41 | $user_id = $this->factory->user->create(); |
| 42 | 42 | $post_id = $this->factory->post->create( |
| 43 | - array( 'post_author' => $user_id ) |
|
| 43 | + array('post_author' => $user_id) |
|
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | 46 | $comment_id = $this->factory->comment->create( |
@@ -51,19 +51,19 @@ discard block |
||
| 51 | 51 | ) |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | - $this->assertEquals( 0, $this->get_user_points( $user_id ) ); |
|
| 54 | + $this->assertEquals(0, $this->get_user_points($user_id)); |
|
| 55 | 55 | |
| 56 | 56 | wp_update_comment( |
| 57 | - array( 'comment_ID' => $comment_id, 'comment_approved' => 1 ) |
|
| 57 | + array('comment_ID' => $comment_id, 'comment_approved' => 1) |
|
| 58 | 58 | ); |
| 59 | 59 | |
| 60 | - $this->assertEquals( 10, $this->get_user_points( $user_id ) ); |
|
| 60 | + $this->assertEquals(10, $this->get_user_points($user_id)); |
|
| 61 | 61 | |
| 62 | 62 | wp_update_comment( |
| 63 | - array( 'comment_ID' => $comment_id, 'comment_approved' => 0 ) |
|
| 63 | + array('comment_ID' => $comment_id, 'comment_approved' => 0) |
|
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | - $this->assertEquals( 0, $this->get_user_points( $user_id ) ); |
|
| 66 | + $this->assertEquals(0, $this->get_user_points($user_id)); |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
@@ -30,17 +30,17 @@ |
||
| 30 | 30 | * |
| 31 | 31 | * @dataProvider data_provider_types |
| 32 | 32 | */ |
| 33 | - public function test( $type ) { |
|
| 33 | + public function test($type) { |
|
| 34 | 34 | |
| 35 | - $this->before( $type ); |
|
| 35 | + $this->before($type); |
|
| 36 | 36 | |
| 37 | 37 | $user_id = $this->factory->user->create(); |
| 38 | 38 | |
| 39 | - $this->assertEquals( 10, $this->get_user_points( $user_id ) ); |
|
| 39 | + $this->assertEquals(10, $this->get_user_points($user_id)); |
|
| 40 | 40 | |
| 41 | - self::delete_user( $user_id ); |
|
| 41 | + self::delete_user($user_id); |
|
| 42 | 42 | |
| 43 | - $this->assertEquals( 0, $this->get_user_points( $user_id ) ); |
|
| 43 | + $this->assertEquals(0, $this->get_user_points($user_id)); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | parent::setUp(); |
| 43 | 43 | |
| 44 | - $this->importer = new WordPoints_Importer_Mock( 'Mock' ); |
|
| 44 | + $this->importer = new WordPoints_Importer_Mock('Mock'); |
|
| 45 | 45 | $this->importer->components = array( |
| 46 | 46 | 'points' => array( |
| 47 | 47 | 'user_points' => array( |
| 48 | 48 | 'label' => 'User points', |
| 49 | - 'function' => array( $this->importer, 'do_an_import' ), |
|
| 50 | - 'can_import' => array( $this->importer, 'can_import' ), |
|
| 49 | + 'function' => array($this->importer, 'do_an_import'), |
|
| 50 | + 'can_import' => array($this->importer, 'can_import'), |
|
| 51 | 51 | ), |
| 52 | 52 | ), |
| 53 | 53 | ); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function test_supports_supported_component() { |
| 71 | 71 | |
| 72 | - $this->assertTrue( $this->importer->supports_component( 'points' ) ); |
|
| 72 | + $this->assertTrue($this->importer->supports_component('points')); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function test_supports_unsupported_component() { |
| 83 | 83 | |
| 84 | - $this->assertFalse( $this->importer->supports_component( 'unsupported' ) ); |
|
| 84 | + $this->assertFalse($this->importer->supports_component('unsupported')); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $this->assertEquals( |
| 97 | 97 | $this->importer_components['points'] |
| 98 | - , $this->importer->get_options_for_component( 'points' ) |
|
| 98 | + , $this->importer->get_options_for_component('points') |
|
| 99 | 99 | ); |
| 100 | 100 | } |
| 101 | 101 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | $this->assertEquals( |
| 112 | 112 | array() |
| 113 | - , $this->importer->get_options_for_component( 'unsupported' ) |
|
| 113 | + , $this->importer->get_options_for_component('unsupported') |
|
| 114 | 114 | ); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -124,19 +124,19 @@ discard block |
||
| 124 | 124 | public function test_do_import_not_installed() { |
| 125 | 125 | |
| 126 | 126 | $this->importer->components = array( |
| 127 | - 'uninstalled' => array( 'method' => 'do_an_import' ), |
|
| 127 | + 'uninstalled' => array('method' => 'do_an_import'), |
|
| 128 | 128 | ); |
| 129 | 129 | |
| 130 | 130 | $feedback = new WordPoints_Importer_Tests_Feedback(); |
| 131 | 131 | $this->importer->do_import( |
| 132 | - array( 'uninstalled' => array( 'do' => 'yes' ) ) |
|
| 132 | + array('uninstalled' => array('do' => 'yes')) |
|
| 133 | 133 | , $feedback |
| 134 | 134 | ); |
| 135 | 135 | |
| 136 | - $this->assertCount( 1, $feedback->messages['warning'] ); |
|
| 136 | + $this->assertCount(1, $feedback->messages['warning']); |
|
| 137 | 137 | |
| 138 | 138 | // The import shouldn't have been performed. |
| 139 | - $this->assertEmpty( $this->importer->imports ); |
|
| 139 | + $this->assertEmpty($this->importer->imports); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -152,14 +152,14 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | $feedback = new WordPoints_Importer_Tests_Feedback(); |
| 154 | 154 | $this->importer->do_import( |
| 155 | - array( 'points' => array( 'do' => 'yes' ) ) |
|
| 155 | + array('points' => array('do' => 'yes')) |
|
| 156 | 156 | , $feedback |
| 157 | 157 | ); |
| 158 | 158 | |
| 159 | - $this->assertCount( 1, $feedback->messages['warning'] ); |
|
| 159 | + $this->assertCount(1, $feedback->messages['warning']); |
|
| 160 | 160 | |
| 161 | 161 | // The import shouldn't have been performed. |
| 162 | - $this->assertEmpty( $this->importer->imports ); |
|
| 162 | + $this->assertEmpty($this->importer->imports); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -171,22 +171,22 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function test_do_import_validates_settings() { |
| 173 | 173 | |
| 174 | - $this->listen_for_filter( 'wordpoints_import_settings_valid-points' ); |
|
| 174 | + $this->listen_for_filter('wordpoints_import_settings_valid-points'); |
|
| 175 | 175 | |
| 176 | - add_filter( 'wordpoints_import_settings_valid-points', '__return_false' ); |
|
| 176 | + add_filter('wordpoints_import_settings_valid-points', '__return_false'); |
|
| 177 | 177 | |
| 178 | 178 | $this->importer->do_import( |
| 179 | - array( 'points' => array( 'do' => 'yes' ) ) |
|
| 179 | + array('points' => array('do' => 'yes')) |
|
| 180 | 180 | , new WordPoints_Importer_Tests_Feedback() |
| 181 | 181 | ); |
| 182 | 182 | |
| 183 | 183 | $this->assertEquals( |
| 184 | 184 | 1 |
| 185 | - , $this->filter_was_called( 'wordpoints_import_settings_valid-points' ) |
|
| 185 | + , $this->filter_was_called('wordpoints_import_settings_valid-points') |
|
| 186 | 186 | ); |
| 187 | 187 | |
| 188 | 188 | // The import shouldn't have been performed. |
| 189 | - $this->assertEmpty( $this->importer->imports ); |
|
| 189 | + $this->assertEmpty($this->importer->imports); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -201,14 +201,14 @@ discard block |
||
| 201 | 201 | $feedback = new WordPoints_Importer_Tests_Feedback(); |
| 202 | 202 | |
| 203 | 203 | $this->importer->do_import( |
| 204 | - array( 'points' => array( 'do' => 'yes' ) ) |
|
| 204 | + array('points' => array('do' => 'yes')) |
|
| 205 | 205 | , $feedback |
| 206 | 206 | ); |
| 207 | 207 | |
| 208 | - $this->assertCount( 1, $feedback->messages['warning'] ); |
|
| 208 | + $this->assertCount(1, $feedback->messages['warning']); |
|
| 209 | 209 | |
| 210 | 210 | // The import shouldn't have been performed. |
| 211 | - $this->assertEmpty( $this->importer->imports ); |
|
| 211 | + $this->assertEmpty($this->importer->imports); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -223,18 +223,18 @@ discard block |
||
| 223 | 223 | $feedback = new WordPoints_Importer_Tests_Feedback(); |
| 224 | 224 | |
| 225 | 225 | $this->importer->components['points']['user_points']['can_import'] = |
| 226 | - array( $this->importer, 'cant_import' ); |
|
| 226 | + array($this->importer, 'cant_import'); |
|
| 227 | 227 | |
| 228 | 228 | $this->importer->do_import( |
| 229 | - array( 'points' => array( 'user_points' => '1' ) ) |
|
| 229 | + array('points' => array('user_points' => '1')) |
|
| 230 | 230 | , $feedback |
| 231 | 231 | ); |
| 232 | 232 | |
| 233 | - $this->assertCount( 1, $this->importer->can_imports ); |
|
| 234 | - $this->assertCount( 1, $feedback->messages['warning'] ); |
|
| 233 | + $this->assertCount(1, $this->importer->can_imports); |
|
| 234 | + $this->assertCount(1, $feedback->messages['warning']); |
|
| 235 | 235 | |
| 236 | 236 | // The import shouldn't have been performed. |
| 237 | - $this->assertEmpty( $this->importer->imports ); |
|
| 237 | + $this->assertEmpty($this->importer->imports); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -250,15 +250,15 @@ discard block |
||
| 250 | 250 | array( |
| 251 | 251 | 'points' => array( |
| 252 | 252 | 'user_points' => '1', |
| 253 | - '_data' => array( 'testing' => 1 ), |
|
| 253 | + '_data' => array('testing' => 1), |
|
| 254 | 254 | ), |
| 255 | 255 | ) |
| 256 | 256 | , new WordPoints_Importer_Tests_Feedback() |
| 257 | 257 | ); |
| 258 | 258 | |
| 259 | - $this->assertCount( 1, $this->importer->can_imports ); |
|
| 259 | + $this->assertCount(1, $this->importer->can_imports); |
|
| 260 | 260 | $this->assertEquals( |
| 261 | - array( 'testing' => 1 ) |
|
| 261 | + array('testing' => 1) |
|
| 262 | 262 | , $this->importer->can_imports[0] |
| 263 | 263 | ); |
| 264 | 264 | } |
@@ -273,11 +273,11 @@ discard block |
||
| 273 | 273 | public function test_do_import() { |
| 274 | 274 | |
| 275 | 275 | $this->importer->do_import( |
| 276 | - array( 'points' => array( 'user_points' => '1' ) ) |
|
| 276 | + array('points' => array('user_points' => '1')) |
|
| 277 | 277 | , new WordPoints_Importer_Tests_Feedback() |
| 278 | 278 | ); |
| 279 | 279 | |
| 280 | - $this->assertCount( 1, $this->importer->imports ); |
|
| 280 | + $this->assertCount(1, $this->importer->imports); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -293,15 +293,15 @@ discard block |
||
| 293 | 293 | array( |
| 294 | 294 | 'points' => array( |
| 295 | 295 | 'user_points' => '1', |
| 296 | - '_data' => array( 'testing' => 1 ), |
|
| 296 | + '_data' => array('testing' => 1), |
|
| 297 | 297 | ), |
| 298 | 298 | ) |
| 299 | 299 | , new WordPoints_Importer_Tests_Feedback() |
| 300 | 300 | ); |
| 301 | 301 | |
| 302 | - $this->assertCount( 1, $this->importer->imports ); |
|
| 302 | + $this->assertCount(1, $this->importer->imports); |
|
| 303 | 303 | $this->assertEquals( |
| 304 | - array( 'testing' => 1 ) |
|
| 304 | + array('testing' => 1) |
|
| 305 | 305 | , $this->importer->imports[0] |
| 306 | 306 | ); |
| 307 | 307 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | WordPoints_Importers::register( |
| 38 | 38 | 'test' |
| 39 | - , array( 'class' => 'WordPoints_Importer_Mock', 'name' => 'Test' ) |
|
| 39 | + , array('class' => 'WordPoints_Importer_Mock', 'name' => 'Test') |
|
| 40 | 40 | ); |
| 41 | 41 | |
| 42 | 42 | } |
@@ -48,17 +48,17 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $importers = WordPoints_Importers::get(); |
| 50 | 50 | |
| 51 | - foreach ( $this->_backup_importers as $slug => $args ) { |
|
| 51 | + foreach ($this->_backup_importers as $slug => $args) { |
|
| 52 | 52 | |
| 53 | - if ( ! isset( $importers[ $slug ] ) ) { |
|
| 54 | - WordPoints_Importers::register( $slug, $args ); |
|
| 53 | + if (!isset($importers[$slug])) { |
|
| 54 | + WordPoints_Importers::register($slug, $args); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - unset( $importers[ $slug ] ); |
|
| 57 | + unset($importers[$slug]); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - foreach ( $importers as $slug => $args ) { |
|
| 61 | - WordPoints_Importers::deregister( $slug ); |
|
| 60 | + foreach ($importers as $slug => $args) { |
|
| 61 | + WordPoints_Importers::deregister($slug); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | parent::tearDown(); |
@@ -76,14 +76,14 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | WordPoints_Importers::register( |
| 78 | 78 | __METHOD__ |
| 79 | - , array( 'class' => 'WordPoints_Importer_Mock', 'name' => 'Test' ) |
|
| 79 | + , array('class' => 'WordPoints_Importer_Mock', 'name' => 'Test') |
|
| 80 | 80 | ); |
| 81 | 81 | |
| 82 | 82 | $importers = WordPoints_Importers::get(); |
| 83 | 83 | |
| 84 | - $this->assertArrayHasKey( 'test', $importers ); |
|
| 84 | + $this->assertArrayHasKey('test', $importers); |
|
| 85 | 85 | $this->assertEquals( |
| 86 | - array( 'class' => 'WordPoints_Importer_Mock', 'name' => 'Test' ) |
|
| 86 | + array('class' => 'WordPoints_Importer_Mock', 'name' => 'Test') |
|
| 87 | 87 | , $importers['test'] |
| 88 | 88 | ); |
| 89 | 89 | } |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function test_deregister() { |
| 100 | 100 | |
| 101 | - WordPoints_Importers::deregister( 'test' ); |
|
| 101 | + WordPoints_Importers::deregister('test'); |
|
| 102 | 102 | |
| 103 | 103 | $importers = WordPoints_Importers::get(); |
| 104 | 104 | |
| 105 | - $this->assertArrayNotHasKey( 'test', $importers ); |
|
| 105 | + $this->assertArrayNotHasKey('test', $importers); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function test_is_registered() { |
| 116 | 116 | |
| 117 | - $this->assertTrue( WordPoints_Importers::is_registered( 'test' ) ); |
|
| 117 | + $this->assertTrue(WordPoints_Importers::is_registered('test')); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function test_is_registered_unregistered() { |
| 128 | 128 | |
| 129 | - WordPoints_Importers::deregister( 'test' ); |
|
| 129 | + WordPoints_Importers::deregister('test'); |
|
| 130 | 130 | |
| 131 | - $this->assertFalse( WordPoints_Importers::is_registered( 'test' ) ); |
|
| 131 | + $this->assertFalse(WordPoints_Importers::is_registered('test')); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public function test_get_unregistered_importer() { |
| 142 | 142 | |
| 143 | - WordPoints_Importers::deregister( 'test' ); |
|
| 143 | + WordPoints_Importers::deregister('test'); |
|
| 144 | 144 | |
| 145 | - $this->assertFalse( WordPoints_Importers::get_importer( 'test' ) ); |
|
| 145 | + $this->assertFalse(WordPoints_Importers::get_importer('test')); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $this->assertInstanceOf( |
| 158 | 158 | 'WordPoints_Importer_Mock' |
| 159 | - , WordPoints_Importers::get_importer( 'test' ) |
|
| 159 | + , WordPoints_Importers::get_importer('test') |
|
| 160 | 160 | ); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @param array $settings The settings for this "component". |
| 62 | 62 | */ |
| 63 | - public function do_an_import( $settings ) { |
|
| 63 | + public function do_an_import($settings) { |
|
| 64 | 64 | |
| 65 | 65 | $this->imports[] = $settings; |
| 66 | 66 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @return true |
| 76 | 76 | */ |
| 77 | - public function can_import( $settings ) { |
|
| 77 | + public function can_import($settings) { |
|
| 78 | 78 | |
| 79 | 79 | $this->can_imports[] = $settings; |
| 80 | 80 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @return WP_Error An error. |
| 92 | 92 | */ |
| 93 | - public function cant_import( $settings ) { |
|
| 93 | + public function cant_import($settings) { |
|
| 94 | 94 | |
| 95 | 95 | $this->can_imports[] = $settings; |
| 96 | 96 | |