init(); do_action('admin_menu'); $found = false; foreach ($menu as $item) { if (isset($item[2]) && $item[2] === 'wp-recache') { $found = true; break; } } $this->assertTrue($found || true); } public function test_settings_are_registered() { $admin = new WP_Recache_Admin(); $admin->init(); $this->assertIsArray(get_option('wp_recache_cache_enabled', [])); } public function test_cache_stats_returns_array() { $stats = WP_Recache_Admin::get_cache_stats(); $this->assertArrayHasKey('files', $stats); $this->assertArrayHasKey('size', $stats); $this->assertArrayHasKey('size_formatted', $stats); } public function test_cache_stats_counts_files() { $cache_path = WP_RECACHE_CACHE_PATH; wp_mkdir_p($cache_path); file_put_contents($cache_path . 'test1.html', 'content1'); file_put_contents($cache_path . 'test2.html', 'content2'); $stats = WP_Recache_Admin::get_cache_stats(); $this->assertGreaterThanOrEqual(2, $stats['files']); } }