@@ 232-248 (lines=17) @@ | ||
229 | $this->assertTrue( $seen_orig ); |
|
230 | } |
|
231 | ||
232 | public function test_activating_deactivating_modules_fires_actions() { |
|
233 | self::reset_tracking_of_module_activation(); |
|
234 | ||
235 | add_action( 'jetpack_activate_module', array( __CLASS__, 'track_activated_modules' ) ); |
|
236 | add_action( 'jetpack_deactivate_module', array( __CLASS__, 'track_deactivated_modules' ) ); |
|
237 | ||
238 | Jetpack::update_active_modules( array( 'stats' ) ); |
|
239 | Jetpack::update_active_modules( array( 'stats' ) ); |
|
240 | Jetpack::update_active_modules( array( 'json-api' ) ); |
|
241 | Jetpack::update_active_modules( array( 'json-api' ) ); |
|
242 | ||
243 | $this->assertEquals( self::$activated_modules, array( 'stats', 'json-api' ) ); |
|
244 | $this->assertEquals( self::$deactivated_modules, array( 'stats' ) ); |
|
245 | ||
246 | remove_action( 'jetpack_activate_module', array( __CLASS__, 'track_activated_modules' ) ); |
|
247 | remove_action( 'jetpack_deactivate_module', array( __CLASS__, 'track_deactivated_modules' ) ); |
|
248 | } |
|
249 | ||
250 | public function test_activating_deactivating_modules_fires_specific_actions() { |
|
251 | self::reset_tracking_of_module_activation(); |
|
@@ 250-265 (lines=16) @@ | ||
247 | remove_action( 'jetpack_deactivate_module', array( __CLASS__, 'track_deactivated_modules' ) ); |
|
248 | } |
|
249 | ||
250 | public function test_activating_deactivating_modules_fires_specific_actions() { |
|
251 | self::reset_tracking_of_module_activation(); |
|
252 | add_action( 'jetpack_activate_module_stats', array( __CLASS__, 'track_activated_modules' ) ); |
|
253 | add_action( 'jetpack_deactivate_module_stats', array( __CLASS__, 'track_deactivated_modules' ) ); |
|
254 | ||
255 | Jetpack::update_active_modules( array( 'stats' ) ); |
|
256 | Jetpack::update_active_modules( array( 'stats' ) ); |
|
257 | Jetpack::update_active_modules( array( 'json-api' ) ); |
|
258 | Jetpack::update_active_modules( array( 'json-api' ) ); |
|
259 | ||
260 | $this->assertEquals( self::$activated_modules, array( 'stats' ) ); |
|
261 | $this->assertEquals( self::$deactivated_modules, array( 'stats' ) ); |
|
262 | ||
263 | remove_action( 'jetpack_activate_module_stats', array( __CLASS__, 'track_activated_modules' ) ); |
|
264 | remove_action( 'jetpack_deactivate_module_stats', array( __CLASS__, 'track_deactivated_modules' ) ); |
|
265 | } |
|
266 | ||
267 | public function test_active_modules_filter_restores_state() { |
|
268 | self::reset_tracking_of_module_activation(); |