mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-09-06 00:50:32 +00:00
Introduces a new "Requires Plugins" plugin header so that plugin developers can list the slugs of the plugins theirs depends on. This will inform users of the requirements, and provide links to the WordPress.org Plugins Repository that they can click to install and activate the dependencies first. Plugins whose requirements are not met cannot be installed or activated, and they will be deactivated automatically if their requirements become unmet. Plugins that others rely on cannot be deactivated or deleted until their dependent plugins are deactivated or deleted. In memory of Alex Mills and Alex King. WordPress Remembers. Props ahoereth, afragen, alanfuller, alexkingorg, amykamala, anonymized_10690803, apeatling, ashfame, atimmer, audrasjb, aristath, azaozz, batmoo, beaulebens, blobaugh, bobbingwide, boonebgorges, brianhenryie, chanthaboune, chrisdavidmiles, coolmann, costdev, courane01, danielbachhuber, davidperez, dd32, Denis-de-Bernardy, dingo_d, DJPaul, dougal, DrewAPicture, ethitter, filosofo, georgestephanis, giuseppemazzapica-1, goldenapples, griffinjt, hellofromTonya, husobj, ideag, jarednova, jbobich, jbrinley, jltallon, joedolson, johnciacia, johnjamesjacoby, joppuyo, jsmoriss, karmatosed, kebbet, knutsp, kraftbj, kraftner, kurtpayne, lkraav, logikal16, luisherranz, man4toman, markjaquith, matt, mbijon, megphillips91, mikeschinkel, mordauk, morehawes, mrwweb, mte90, mukesh27, mzaweb, nacin, norcross, nvwd, nwjames, obliviousharmony, ocean90, oglekler, paaljoachim, pauldewouters, pbaylies, pbiron, peterwilsoncc, Philipp15b, poena, pogidude, retlehs, rmccue, ryan, sabreuse, sc0ttkclark, scribu, sereedmedia, SergeyBiryukov, ShaneF, shidouhikari, soean, spacedmonkey, stephenh1988, swissspidy, taylorde, tazotodua, threadi, TimothyBlynJacobs, TJNowell, tollmanz, toscho, tropicalista, Viper007Bond, westi, whiteshadow, williamsba1, wpsmith, ZaneMatthew. Fixes #22316. git-svn-id: https://develop.svn.wordpress.org/trunk@57545 602fd350-edb4-49c9-b593-d223f7449a82
77 lines
1.7 KiB
PHP
77 lines
1.7 KiB
PHP
<?php
|
|
/**
|
|
* Tests for the WP_Plugin_Dependencies::get_dependent_names() method.
|
|
*
|
|
* @package WordPress
|
|
*/
|
|
|
|
require_once __DIR__ . '/base.php';
|
|
|
|
/**
|
|
* @group admin
|
|
* @group plugins
|
|
*
|
|
* @covers WP_Plugin_Dependencies::get_dependent_names
|
|
* @covers WP_Plugin_Dependencies::get_plugins
|
|
* @covers WP_Plugin_Dependencies::convert_to_slug
|
|
* @covers WP_Plugin_Dependencies::get_dependents
|
|
*/
|
|
class Tests_Admin_WPPluginDependencies_GetDependentNames extends WP_PluginDependencies_UnitTestCase {
|
|
|
|
/**
|
|
* Tests that dependent names are retrieved.
|
|
*
|
|
* @ticket 22316
|
|
*/
|
|
public function test_should_get_dependent_names() {
|
|
$this->set_property_value(
|
|
'plugins',
|
|
array(
|
|
'dependent/dependent.php' => array(
|
|
'Name' => 'Dependent 1',
|
|
'RequiresPlugins' => 'dependency',
|
|
),
|
|
'dependent2/dependent2.php' => array(
|
|
'Name' => 'Dependent 2',
|
|
'RequiresPlugins' => 'dependency',
|
|
),
|
|
)
|
|
);
|
|
|
|
self::$instance::initialize();
|
|
|
|
$this->assertSame(
|
|
array( 'Dependent 1', 'Dependent 2' ),
|
|
self::$instance::get_dependent_names( 'dependency/dependency.php' )
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Tests that dependent names are sorted.
|
|
*
|
|
* @ticket 22316
|
|
*/
|
|
public function test_should_sort_dependent_names() {
|
|
$this->set_property_value(
|
|
'plugins',
|
|
array(
|
|
'dependent2/dependent2.php' => array(
|
|
'Name' => 'Dependent 2',
|
|
'RequiresPlugins' => 'dependency',
|
|
),
|
|
'dependent/dependent.php' => array(
|
|
'Name' => 'Dependent 1',
|
|
'RequiresPlugins' => 'dependency',
|
|
),
|
|
)
|
|
);
|
|
|
|
self::$instance::initialize();
|
|
|
|
$this->assertSame(
|
|
array( 'Dependent 1', 'Dependent 2' ),
|
|
self::$instance::get_dependent_names( 'dependency/dependency.php' )
|
|
);
|
|
}
|
|
}
|