When no plugins are active, return an empty array from `validate_active_plugins()`.
This creates parity with the behavior of the function when plugins *are* active, but none are invalid. It also makes it possible to write unit tests for the function. Props sgrant. Fixes #30860. git-svn-id: https://develop.svn.wordpress.org/trunk@31003 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8d2c1bdc72
commit
e85543f68b
|
@ -884,7 +884,7 @@ function validate_active_plugins() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( empty( $plugins ) )
|
if ( empty( $plugins ) )
|
||||||
return;
|
return array();
|
||||||
|
|
||||||
$invalid = array();
|
$invalid = array();
|
||||||
|
|
||||||
|
|
|
@ -292,6 +292,13 @@ class Tests_Admin_includesPlugin extends WP_UnitTestCase {
|
||||||
$this->assertTrue( isset( $result[ $plugin[ 0 ] ] ) );
|
$this->assertTrue( isset( $result[ $plugin[ 0 ] ] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers ::validate_active_plugins
|
||||||
|
*/
|
||||||
|
public function test_validate_active_plugins_empty() {
|
||||||
|
$this->assertEquals( array(), validate_active_plugins() );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers ::is_uninstallable_plugin
|
* @covers ::is_uninstallable_plugin
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue