|
@@ 31-47 (lines=17) @@
|
| 28 |
|
/** |
| 29 |
|
* Tests that `find_class_file` returns the path to the class when present in the classmap. |
| 30 |
|
*/ |
| 31 |
|
public function test_find_class_file_returns_path_for_classmap() { |
| 32 |
|
$version_loader = new Version_Loader( |
| 33 |
|
new Version_Selector(), |
| 34 |
|
array( |
| 35 |
|
Test::class => array( |
| 36 |
|
'version' => '1.0.0.0', |
| 37 |
|
'path' => TEST_DATA_PATH . '/plugins/plugin_current/includes/class-test.php', |
| 38 |
|
), |
| 39 |
|
), |
| 40 |
|
null, |
| 41 |
|
null |
| 42 |
|
); |
| 43 |
|
|
| 44 |
|
$file_path = $version_loader->find_class_file( Test::class ); |
| 45 |
|
|
| 46 |
|
$this->assertEquals( TEST_DATA_PATH . '/plugins/plugin_current/includes/class-test.php', $file_path ); |
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
/** |
| 50 |
|
* Test that `find_class_file` returns the path to the class when present in the PSR-4 map. |
|
@@ 52-68 (lines=17) @@
|
| 49 |
|
/** |
| 50 |
|
* Test that `find_class_file` returns the path to the class when present in the PSR-4 map. |
| 51 |
|
*/ |
| 52 |
|
public function test_find_class_file_returns_path_for_psr4() { |
| 53 |
|
$version_loader = new Version_Loader( |
| 54 |
|
new Version_Selector(), |
| 55 |
|
null, |
| 56 |
|
array( |
| 57 |
|
'Jetpack\\AutoloaderTestData\\Plugin\\' => array( |
| 58 |
|
'version' => '1.0.0.0', |
| 59 |
|
'path' => array( TEST_DATA_PATH . '/plugins/plugin_current/src' ), |
| 60 |
|
), |
| 61 |
|
), |
| 62 |
|
null |
| 63 |
|
); |
| 64 |
|
|
| 65 |
|
$file_path = $version_loader->find_class_file( Psr4Test::class ); |
| 66 |
|
|
| 67 |
|
$this->assertEquals( TEST_DATA_PATH . '/plugins/plugin_current/src/Psr4/Test.php', $file_path ); |
| 68 |
|
} |
| 69 |
|
|
| 70 |
|
/** |
| 71 |
|
* Tests that `find_class_file` returns the path to the class when presented |