|
@@ 74-94 (lines=21) @@
|
| 71 |
|
* Tests that `find_class_file` returns the path to the class when presented |
| 72 |
|
* with less-specific namespaces first in the PSR-4 map. |
| 73 |
|
*/ |
| 74 |
|
public function test_find_class_file_checks_returns_path_for_psr4_with_less_specific_namespace() { |
| 75 |
|
$version_loader = new Version_Loader( |
| 76 |
|
new Version_Selector(), |
| 77 |
|
null, |
| 78 |
|
array( |
| 79 |
|
'Jetpack\\AutoloaderTestData\\' => array( |
| 80 |
|
'version' => '1.0.0.0', |
| 81 |
|
'path' => array( TEST_DATA_PATH . '/plugins/plugin_current' ), |
| 82 |
|
), |
| 83 |
|
'Jetpack\\AutoloaderTestData\\Plugin\\' => array( |
| 84 |
|
'version' => '1.0.0.0', |
| 85 |
|
'path' => array( TEST_DATA_PATH . '/plugins/plugin_current/src' ), |
| 86 |
|
), |
| 87 |
|
), |
| 88 |
|
null |
| 89 |
|
); |
| 90 |
|
|
| 91 |
|
$file_path = $version_loader->find_class_file( Psr4Test::class ); |
| 92 |
|
|
| 93 |
|
$this->assertEquals( TEST_DATA_PATH . '/plugins/plugin_current/src/Psr4/Test.php', $file_path ); |
| 94 |
|
} |
| 95 |
|
|
| 96 |
|
/** |
| 97 |
|
* Test that `find_class_file` returns the classmap version when newer. |
|
@@ 99-120 (lines=22) @@
|
| 96 |
|
/** |
| 97 |
|
* Test that `find_class_file` returns the classmap version when newer. |
| 98 |
|
*/ |
| 99 |
|
public function test_find_class_file_returns_newer_classmap() { |
| 100 |
|
$version_loader = new Version_Loader( |
| 101 |
|
new Version_Selector(), |
| 102 |
|
array( |
| 103 |
|
Psr4Test::class => array( |
| 104 |
|
'version' => '2.0.0.0', |
| 105 |
|
'path' => TEST_DATA_PATH . '/plugins/plugin_newer/src/Psr4/Test.php', |
| 106 |
|
), |
| 107 |
|
), |
| 108 |
|
array( |
| 109 |
|
'Jetpack\\AutoloaderTestData\\Plugin\\' => array( |
| 110 |
|
'version' => '1.0.0.0', |
| 111 |
|
'path' => array( TEST_DATA_PATH . '/plugins/plugin_current/src' ), |
| 112 |
|
), |
| 113 |
|
), |
| 114 |
|
null |
| 115 |
|
); |
| 116 |
|
|
| 117 |
|
$file_path = $version_loader->find_class_file( Psr4Test::class ); |
| 118 |
|
|
| 119 |
|
$this->assertEquals( TEST_DATA_PATH . '/plugins/plugin_newer/src/Psr4/Test.php', $file_path ); |
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
/** |
| 123 |
|
* Test that `find_class_file` returns the PSR-4 version when newer. |
|
@@ 125-146 (lines=22) @@
|
| 122 |
|
/** |
| 123 |
|
* Test that `find_class_file` returns the PSR-4 version when newer. |
| 124 |
|
*/ |
| 125 |
|
public function test_find_class_file_returns_newer_psr4() { |
| 126 |
|
$version_loader = new Version_Loader( |
| 127 |
|
new Version_Selector(), |
| 128 |
|
array( |
| 129 |
|
Psr4Test::class => array( |
| 130 |
|
'version' => '1.0.0.0', |
| 131 |
|
'path' => TEST_DATA_PATH . '/plugins/plugin_current/src/Psr4/Test.php', |
| 132 |
|
), |
| 133 |
|
), |
| 134 |
|
array( |
| 135 |
|
'Jetpack\\AutoloaderTestData\\Plugin\\' => array( |
| 136 |
|
'version' => '2.0.0.0', |
| 137 |
|
'path' => array( TEST_DATA_PATH . '/plugins/plugin_newer/src' ), |
| 138 |
|
), |
| 139 |
|
), |
| 140 |
|
null |
| 141 |
|
); |
| 142 |
|
|
| 143 |
|
$file_path = $version_loader->find_class_file( Psr4Test::class ); |
| 144 |
|
|
| 145 |
|
$this->assertEquals( TEST_DATA_PATH . '/plugins/plugin_newer/src/Psr4/Test.php', $file_path ); |
| 146 |
|
} |
| 147 |
|
|
| 148 |
|
/** |
| 149 |
|
* Tests that `load_filemap` correctly loads all of the files. |