| @@ 40-58 (lines=19) @@ | ||
| 37 | /** |
|
| 38 | * Tests that the classmap manifest from a single plugin can be handled correctly. |
|
| 39 | */ |
|
| 40 | public function test_classmap() { |
|
| 41 | $path_map = array(); |
|
| 42 | $this->manifest_handler->read_manifests( |
|
| 43 | array( TEST_PLUGIN_DIR ), |
|
| 44 | 'vendor/composer/jetpack_autoload_classmap.php', |
|
| 45 | $path_map |
|
| 46 | ); |
|
| 47 | ||
| 48 | $loader = new Version_Loader( |
|
| 49 | new Version_Selector(), |
|
| 50 | $path_map, |
|
| 51 | null, |
|
| 52 | null |
|
| 53 | ); |
|
| 54 | ||
| 55 | $file = $loader->find_class_file( Classmap_Test_Class::class ); |
|
| 56 | ||
| 57 | $this->assertEquals( TEST_PLUGIN_DIR . '/includes/class-classmap-test-class.php', $file ); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Tests that the PSR-4 manifest from a single plugin can be handled correctly. |
|
| @@ 63-81 (lines=19) @@ | ||
| 60 | /** |
|
| 61 | * Tests that the PSR-4 manifest from a single plugin can be handled correctly. |
|
| 62 | */ |
|
| 63 | public function test_psr4() { |
|
| 64 | $path_map = array(); |
|
| 65 | $this->manifest_handler->read_manifests( |
|
| 66 | array( TEST_PLUGIN_DIR ), |
|
| 67 | 'vendor/composer/jetpack_autoload_psr4.php', |
|
| 68 | $path_map |
|
| 69 | ); |
|
| 70 | ||
| 71 | $loader = new Version_Loader( |
|
| 72 | new Version_Selector(), |
|
| 73 | null, |
|
| 74 | $path_map, |
|
| 75 | null |
|
| 76 | ); |
|
| 77 | ||
| 78 | $file = $loader->find_class_file( UniqueTestClass::class ); |
|
| 79 | ||
| 80 | $this->assertEquals( TEST_PLUGIN_DIR . '/src/Current/UniqueTestClass.php', $file ); |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * Tests that the filemap manifest from a single plugin can be handled correctly. |
|
| @@ 89-108 (lines=20) @@ | ||
| 86 | * @preserveGlobalState disabled |
|
| 87 | * @runInSeparateProcess |
|
| 88 | */ |
|
| 89 | public function test_filemap() { |
|
| 90 | $path_map = array(); |
|
| 91 | $this->manifest_handler->read_manifests( |
|
| 92 | array( TEST_PLUGIN_DIR ), |
|
| 93 | 'vendor/composer/jetpack_autoload_filemap.php', |
|
| 94 | $path_map |
|
| 95 | ); |
|
| 96 | ||
| 97 | $loader = new Version_Loader( |
|
| 98 | new Version_Selector(), |
|
| 99 | null, |
|
| 100 | null, |
|
| 101 | $path_map |
|
| 102 | ); |
|
| 103 | ||
| 104 | $loader->load_filemap(); |
|
| 105 | ||
| 106 | global $jetpack_autoloader_testing_loaded_files; |
|
| 107 | $this->assertContains( Test_Plugin_Factory::VERSION_CURRENT, $jetpack_autoloader_testing_loaded_files ); |
|
| 108 | } |
|
| 109 | } |
|
| 110 | ||