@@ 279-295 (lines=17) @@ | ||
276 | * @covers Automattic\Jetpack\Connection\Manager::delete_all_connection_tokens |
|
277 | * @throws MockEnabledException PHPUnit wasn't able to enable mock functions. |
|
278 | */ |
|
279 | public function test_delete_all_connection_tokens() { |
|
280 | $this->update_option->enable(); |
|
281 | $this->get_option->enable(); |
|
282 | $this->apply_filters->enable(); |
|
283 | $this->do_action->enable(); |
|
284 | ||
285 | ( new Plugin( 'plugin-slug-1' ) )->add( 'Plugin Name 1' ); |
|
286 | ||
287 | ( new Plugin( 'plugin-slug-2' ) )->add( 'Plugin Name 2' ); |
|
288 | ||
289 | $stub = $this->createMock( Plugin::class ); |
|
290 | $stub->method( 'is_only' ) |
|
291 | ->willReturn( false ); |
|
292 | $manager = ( new Manager() )->set_plugin_instance( $stub ); |
|
293 | ||
294 | $this->assertFalse( $manager->delete_all_connection_tokens() ); |
|
295 | } |
|
296 | ||
297 | /** |
|
298 | * Unit test for the "Disconnect from WP" functionality. |
|
@@ 303-319 (lines=17) @@ | ||
300 | * @covers Automattic\Jetpack\Connection\Manager::disconnect_site_wpcom |
|
301 | * @throws MockEnabledException PHPUnit wasn't able to enable mock functions. |
|
302 | */ |
|
303 | public function test_disconnect_site_wpcom() { |
|
304 | $this->update_option->enable(); |
|
305 | $this->get_option->enable(); |
|
306 | $this->apply_filters->enable(); |
|
307 | $this->do_action->enable(); |
|
308 | ||
309 | ( new Plugin( 'plugin-slug-1' ) )->add( 'Plugin Name 1' ); |
|
310 | ||
311 | ( new Plugin( 'plugin-slug-2' ) )->add( 'Plugin Name 2' ); |
|
312 | ||
313 | $stub = $this->createMock( Plugin::class ); |
|
314 | $stub->method( 'is_only' ) |
|
315 | ->willReturn( false ); |
|
316 | $manager = ( new Manager() )->set_plugin_instance( $stub ); |
|
317 | ||
318 | $this->assertFalse( $manager->disconnect_site_wpcom() ); |
|
319 | } |
|
320 | ||
321 | /** |
|
322 | * Test the `jetpack_connection_custom_caps' method. |