setAccessible(true); $this->assertSame(115, $method->invoke($adapter, 'https://www.huxiu.com/channel/115.html')); $this->assertNull($method->invoke($adapter, 'https://www.huxiu.com/article/123.html')); } public function test_fetches_article_detail_via_api(): void { $adapter = new HuxiuHtmlAdapter( app(\App\Services\Crawl\NewsCategoryMatcher::class), app(\App\Services\Crawl\NewsHtmlImageLocalizer::class), ); $method = new \ReflectionMethod($adapter, 'fetchArticleDetail'); $method->setAccessible(true); $detail = $method->invoke($adapter, 'https://www.huxiu.com/article/4869203.html'); $this->assertNotEmpty($detail['title']); $this->assertNotEmpty($detail['content_html']); $this->assertGreaterThan(200, mb_strlen(strip_tags((string) $detail['content_html']))); } }