|
@@ 91-103 (lines=13) @@
|
| 88 |
|
/** |
| 89 |
|
* Tests that the autoloader loads the latest when loading an older one first. |
| 90 |
|
*/ |
| 91 |
|
public function test_autoloader_loads_latest() { |
| 92 |
|
$this->activate_plugin( 'plugin_current' ); |
| 93 |
|
$this->activate_plugin( 'plugin_newer' ); |
| 94 |
|
|
| 95 |
|
$this->load_autoloader( 'plugin_current' ); |
| 96 |
|
$this->load_autoloader( 'plugin_newer' ); |
| 97 |
|
|
| 98 |
|
$this->assertFalse( $this->autoloader_reset ); |
| 99 |
|
$this->assertAutoloaderVersion( '2.7.0.0' ); |
| 100 |
|
|
| 101 |
|
$this->shutdown_autoloader( true ); |
| 102 |
|
$this->assertAutoloaderCache( array( 'plugin_current', 'plugin_newer' ) ); |
| 103 |
|
} |
| 104 |
|
|
| 105 |
|
/** |
| 106 |
|
* Tests that the autoloader does not conflict with a v1 autoloader. |
|
@@ 125-137 (lines=13) @@
|
| 122 |
|
/** |
| 123 |
|
* Tests that the autoloader is not reset when an older V2 initializes after the latest. |
| 124 |
|
*/ |
| 125 |
|
public function test_autoloader_not_reset_by_older_v2() { |
| 126 |
|
$this->activate_plugin( 'plugin_current' ); |
| 127 |
|
$this->activate_plugin( 'plugin_v2_2_0' ); |
| 128 |
|
|
| 129 |
|
$this->load_autoloader( 'plugin_current' ); |
| 130 |
|
$this->load_autoloader( 'plugin_v2_2_0' ); |
| 131 |
|
|
| 132 |
|
$this->assertFalse( $this->autoloader_reset ); |
| 133 |
|
$this->assertAutoloaderVersion( '2.6.0.0' ); |
| 134 |
|
|
| 135 |
|
$this->shutdown_autoloader( true ); |
| 136 |
|
$this->assertAutoloaderCache( array( 'plugin_current', 'plugin_v2_2_0' ) ); |
| 137 |
|
} |
| 138 |
|
|
| 139 |
|
/** |
| 140 |
|
* Tests that the autoloader resets when an unknown plugin is encountered, and that it does not |
|
@@ 159-173 (lines=15) @@
|
| 156 |
|
/** |
| 157 |
|
* Tests that the autoloader uses the cache to avoid resetting when an known plugin is encountered. |
| 158 |
|
*/ |
| 159 |
|
public function test_autoloader_uses_cache_to_avoid_resets() { |
| 160 |
|
$this->activate_plugin( 'plugin_current' ); |
| 161 |
|
|
| 162 |
|
// Write the plugins to the cache so that the autoloader will see them. |
| 163 |
|
$this->cache_plugins( array( 'plugin_current', 'plugin_newer' ) ); |
| 164 |
|
|
| 165 |
|
$this->load_autoloader( 'plugin_current' ); |
| 166 |
|
$this->load_autoloader( 'plugin_newer' ); |
| 167 |
|
|
| 168 |
|
$this->assertFalse( $this->autoloader_reset ); |
| 169 |
|
$this->assertAutoloaderVersion( '2.7.0.0' ); |
| 170 |
|
|
| 171 |
|
$this->shutdown_autoloader( true ); |
| 172 |
|
$this->assertAutoloaderCache( array( 'plugin_current', 'plugin_newer' ) ); |
| 173 |
|
} |
| 174 |
|
|
| 175 |
|
/** |
| 176 |
|
* Tests that the autoloader updates the cache. |