|
@@ 19-33 (lines=15) @@
|
| 16 |
|
/** |
| 17 |
|
* Tests whether registering a manifest file registers the individual class file. |
| 18 |
|
*/ |
| 19 |
|
public function test_registering_adds_to_the_input_array() { |
| 20 |
|
$input_array = array(); |
| 21 |
|
$manifest_handler = new Manifest_Handler( |
| 22 |
|
array( |
| 23 |
|
TEST_DATA_PATH . '/plugins/plugin_current', |
| 24 |
|
), |
| 25 |
|
new Version_Selector() |
| 26 |
|
); |
| 27 |
|
|
| 28 |
|
$manifest_handler->register_plugin_manifests( 'vendor/composer/jetpack_autoload_classmap.php', $input_array ); |
| 29 |
|
|
| 30 |
|
$this->assertArrayHasKey( Test::class, $input_array ); |
| 31 |
|
$this->assertEquals( '1.0.0.0', $input_array[ Test::class ]['version'] ); |
| 32 |
|
$this->assertEquals( $input_array[ Test::class ]['path'], TEST_DATA_PATH . '/plugins/plugin_current/includes/class-test.php' ); |
| 33 |
|
} |
| 34 |
|
|
| 35 |
|
/** |
| 36 |
|
* Tests whether registering a manifest file will override already registered paths with newer ones. |
|
@@ 38-53 (lines=16) @@
|
| 35 |
|
/** |
| 36 |
|
* Tests whether registering a manifest file will override already registered paths with newer ones. |
| 37 |
|
*/ |
| 38 |
|
public function test_registering_adds_latest_version_to_the_input_array() { |
| 39 |
|
$input_array = array(); |
| 40 |
|
$manifest_handler = new Manifest_Handler( |
| 41 |
|
array( |
| 42 |
|
TEST_DATA_PATH . '/plugins/plugin_newer', |
| 43 |
|
TEST_DATA_PATH . '/plugins/plugin_current', |
| 44 |
|
), |
| 45 |
|
new Version_Selector() |
| 46 |
|
); |
| 47 |
|
|
| 48 |
|
$manifest_handler->register_plugin_manifests( 'vendor/composer/jetpack_autoload_classmap.php', $input_array ); |
| 49 |
|
|
| 50 |
|
$this->assertArrayHasKey( Test::class, $input_array ); |
| 51 |
|
$this->assertEquals( '2.0.0.0', $input_array[ Test::class ]['version'] ); |
| 52 |
|
$this->assertEquals( $input_array[ Test::class ]['path'], TEST_DATA_PATH . '/plugins/plugin_newer/includes/class-test.php' ); |
| 53 |
|
} |
| 54 |
|
|
| 55 |
|
/** |
| 56 |
|
* Tests whether registering a manifest file ignores the dev version of the file when |
|
@@ 59-74 (lines=16) @@
|
| 56 |
|
* Tests whether registering a manifest file ignores the dev version of the file when |
| 57 |
|
* JETPACK_AUTOLOAD_DEV is not set. |
| 58 |
|
*/ |
| 59 |
|
public function test_registering_does_not_add_dev_versions_to_the_input_array() { |
| 60 |
|
$input_array = array(); |
| 61 |
|
$manifest_handler = new Manifest_Handler( |
| 62 |
|
array( |
| 63 |
|
TEST_DATA_PATH . '/plugins/plugin_dev', |
| 64 |
|
TEST_DATA_PATH . '/plugins/plugin_current', |
| 65 |
|
), |
| 66 |
|
new Version_Selector() |
| 67 |
|
); |
| 68 |
|
|
| 69 |
|
$manifest_handler->register_plugin_manifests( 'vendor/composer/jetpack_autoload_classmap.php', $input_array ); |
| 70 |
|
|
| 71 |
|
$this->assertArrayHasKey( Test::class, $input_array ); |
| 72 |
|
$this->assertEquals( '1.0.0.0', $input_array[ Test::class ]['version'] ); |
| 73 |
|
$this->assertEquals( $input_array[ Test::class ]['path'], TEST_DATA_PATH . '/plugins/plugin_current/includes/class-test.php' ); |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
/** |
| 77 |
|
* Tests whether registering a manifest file prioritizes the dev version of the file when |