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