refactor(fetcher): split 611-line fetcher into 3 focused files

Extract source-resolution and RSS-specific logic from the monolithic
Peptide_News_Fetcher:

- class-peptide-news-source-resolver.php (229 lines) — aggregator
  source detection, redirect resolution, title parsing, backfill
- class-peptide-news-rss-source.php (118 lines) — RSS/Atom feed
  fetching and SimplePie item processing
- class-peptide-news-fetcher.php (271 lines) — orchestrator with
  NewsAPI, storage, pruning, caching, and AI post-processing

Also consolidated duplicate clear_article_cache/invalidate_rest_api_cache
methods (they were identical) into a single clear_article_cache().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
peptiderepo
2026-04-16 22:30:50 +07:00
parent 69cb00063f
commit 64e715372a
5 changed files with 380 additions and 369 deletions

View File

@@ -9,7 +9,9 @@ namespace PeptideNews\Tests\Unit;
use PHPUnit\Framework\TestCase;
// Load the class under test.
// Load the class under test and its dependencies.
require_once PEPTIDE_NEWS_PLUGIN_DIR . 'includes/class-peptide-news-source-resolver.php';
require_once PEPTIDE_NEWS_PLUGIN_DIR . 'includes/class-peptide-news-rss-source.php';
require_once PEPTIDE_NEWS_PLUGIN_DIR . 'includes/class-peptide-news-fetcher.php';
class FetcherTest extends TestCase {