File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ public function test_invalid_file() {
131131 * @group ms-excluded
132132 *
133133 * @covers ::delete_plugins
134+ * @covers ::wp_clean_plugins_cache
134135 */
135136 public function test_delete_plugin () {
136137 $ this ->_setRole ( 'administrator ' );
@@ -139,6 +140,17 @@ public function test_delete_plugin() {
139140 $ _POST ['plugin ' ] = 'foo.php ' ;
140141 $ _POST ['slug ' ] = 'foo ' ;
141142
143+ // Adds the plugin cache.
144+ $ plugins_cache = array (
145+ '' => array (
146+ 'foo.php ' => array (
147+ 'Name ' => 'Foo Plugin ' ,
148+ 'Version ' => '1.0 ' ,
149+ ),
150+ ),
151+ );
152+ wp_cache_set ( 'plugins ' , $ plugins_cache , 'plugins ' );
153+
142154 // Make the request.
143155 try {
144156 $ this ->_handleAjax ( 'delete-plugin ' );
@@ -160,5 +172,8 @@ public function test_delete_plugin() {
160172 );
161173
162174 $ this ->assertSameSets ( $ expected , $ response );
175+
176+ // Verify that wp_clean_plugins_cache() was called and cleared both cache and transient.
177+ $ this ->assertFalse ( wp_cache_get ( 'plugins ' , 'plugins ' ), 'Plugins cache should be cleared after delete_plugins() ' );
163178 }
164179}
You can’t perform that action at this time.
0 commit comments