Make WordPress Core


Ignore:
Timestamp:
11/25/2014 01:12:39 AM (10 years ago)
Author:
boonebgorges
Message:

Add basic unit tests for is_plugin_active() and is_plugin_inactive().

Props voldemortensen.
Fixes #30489.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/admin/includesPlugin.php

    r28706 r30557  
    5757        wp_set_current_user( $current_user );
    5858    }
     59
     60    function test_is_plugin_active_true() {
     61        activate_plugin( 'hello.php' );
     62        $test = is_plugin_active( 'hello.php' );
     63        $this->assertTrue( $test );
     64    }
     65
     66    function test_is_plugin_active_false() {
     67        deactivate_plugins( 'hello.php' );
     68        $test = is_plugin_active( 'hello.php' );
     69        $this->assertFalse( $test );
     70    }
     71
     72    function test_is_plugin_inactive_true() {
     73        deactivate_plugins( 'hello.php' );
     74        $test = is_plugin_inactive( 'hello.php' );
     75        $this->assertTrue( $test );
     76    }
     77
     78    function test_is_plugin_inactive_false() {
     79        activate_plugin( 'hello.php' );
     80        $test = is_plugin_inactive( 'hello.php' );
     81        $this->assertFalse( $test );
     82    }
    5983}
Note: See TracChangeset for help on using the changeset viewer.