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