From 4537217cf168057339faa770294eb6ac0d1fbf1d Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Tue, 25 Nov 2014 01:12:39 +0000 Subject: [PATCH] Add basic unit tests for `is_plugin_active()` and `is_plugin_inactive()`. Props voldemortensen. Fixes #30489. git-svn-id: https://develop.svn.wordpress.org/trunk@30557 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/admin/includesPlugin.php | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/phpunit/tests/admin/includesPlugin.php b/tests/phpunit/tests/admin/includesPlugin.php index 9a0cbc95d4..316d7c8dc0 100644 --- a/tests/phpunit/tests/admin/includesPlugin.php +++ b/tests/phpunit/tests/admin/includesPlugin.php @@ -56,4 +56,28 @@ class Tests_Admin_includesPlugin extends WP_UnitTestCase { wp_set_current_user( $current_user ); } + + function test_is_plugin_active_true() { + activate_plugin( 'hello.php' ); + $test = is_plugin_active( 'hello.php' ); + $this->assertTrue( $test ); + } + + function test_is_plugin_active_false() { + deactivate_plugins( 'hello.php' ); + $test = is_plugin_active( 'hello.php' ); + $this->assertFalse( $test ); + } + + function test_is_plugin_inactive_true() { + deactivate_plugins( 'hello.php' ); + $test = is_plugin_inactive( 'hello.php' ); + $this->assertTrue( $test ); + } + + function test_is_plugin_inactive_false() { + activate_plugin( 'hello.php' ); + $test = is_plugin_inactive( 'hello.php' ); + $this->assertFalse( $test ); + } }