|
@@ 100-120 (lines=21) @@
|
| 97 |
|
* Tests that `find_class_file` returns the path to the class when presented |
| 98 |
|
* with less-specific namespaces first in the PSR-4 map. |
| 99 |
|
*/ |
| 100 |
|
public function test_find_class_file_checks_returns_path_for_psr4_with_less_specific_namespace() { |
| 101 |
|
$version_loader = new Version_Loader( |
| 102 |
|
new Version_Selector(), |
| 103 |
|
null, |
| 104 |
|
array( |
| 105 |
|
Test_Plugin_Factory::TESTING_NAMESPACE => array( |
| 106 |
|
'version' => '1.0.0.0', |
| 107 |
|
'path' => array( TEST_PLUGIN_DIR . '/src' ), |
| 108 |
|
), |
| 109 |
|
Test_Plugin_Factory::TESTING_NAMESPACE . 'Current\\' => array( |
| 110 |
|
'version' => '1.0.0.0', |
| 111 |
|
'path' => array( TEST_PLUGIN_DIR . '/src/Current' ), |
| 112 |
|
), |
| 113 |
|
), |
| 114 |
|
null |
| 115 |
|
); |
| 116 |
|
|
| 117 |
|
$file_path = $version_loader->find_class_file( UniqueTestClass::class ); |
| 118 |
|
|
| 119 |
|
$this->assertEquals( TEST_PLUGIN_DIR . '/src/Current/UniqueTestClass.php', $file_path ); |
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
/** |
| 123 |
|
* Test that `find_class_file` returns the classmap version when newer. |
|
@@ 125-146 (lines=22) @@
|
| 122 |
|
/** |
| 123 |
|
* Test that `find_class_file` returns the classmap version when newer. |
| 124 |
|
*/ |
| 125 |
|
public function test_find_class_file_returns_newer_classmap() { |
| 126 |
|
$version_loader = new Version_Loader( |
| 127 |
|
new Version_Selector(), |
| 128 |
|
array( |
| 129 |
|
SharedTestClass::class => array( |
| 130 |
|
'version' => '2.0.0.0', |
| 131 |
|
'path' => TEST_PLUGIN_DIR . '/src/SharedTestClass.php', |
| 132 |
|
), |
| 133 |
|
), |
| 134 |
|
array( |
| 135 |
|
Test_Plugin_Factory::TESTING_NAMESPACE => array( |
| 136 |
|
'version' => '1.0.0.0', |
| 137 |
|
'path' => array( self::$older_plugin_dir . '/src' ), |
| 138 |
|
), |
| 139 |
|
), |
| 140 |
|
null |
| 141 |
|
); |
| 142 |
|
|
| 143 |
|
$file_path = $version_loader->find_class_file( SharedTestClass::class ); |
| 144 |
|
|
| 145 |
|
$this->assertEquals( TEST_PLUGIN_DIR . '/src/SharedTestClass.php', $file_path ); |
| 146 |
|
} |
| 147 |
|
|
| 148 |
|
/** |
| 149 |
|
* Test that `find_class_file` returns the PSR-4 version when newer. |
|
@@ 151-172 (lines=22) @@
|
| 148 |
|
/** |
| 149 |
|
* Test that `find_class_file` returns the PSR-4 version when newer. |
| 150 |
|
*/ |
| 151 |
|
public function test_find_class_file_returns_newer_psr4() { |
| 152 |
|
$version_loader = new Version_Loader( |
| 153 |
|
new Version_Selector(), |
| 154 |
|
array( |
| 155 |
|
SharedTestClass::class => array( |
| 156 |
|
'version' => '1.0.0.0', |
| 157 |
|
'path' => self::$older_plugin_dir . '/src/SharedTestClass.php', |
| 158 |
|
), |
| 159 |
|
), |
| 160 |
|
array( |
| 161 |
|
Test_Plugin_Factory::TESTING_NAMESPACE => array( |
| 162 |
|
'version' => '2.0.0.0', |
| 163 |
|
'path' => array( TEST_PLUGIN_DIR . '/src' ), |
| 164 |
|
), |
| 165 |
|
), |
| 166 |
|
null |
| 167 |
|
); |
| 168 |
|
|
| 169 |
|
$file_path = $version_loader->find_class_file( SharedTestClass::class ); |
| 170 |
|
|
| 171 |
|
$this->assertEquals( TEST_PLUGIN_DIR . '/src/SharedTestClass.php', $file_path ); |
| 172 |
|
} |
| 173 |
|
|
| 174 |
|
/** |
| 175 |
|
* Tests that `load_filemap` correctly loads all of the files. |