Publish approved compact advertisements and synchronize related project sources

This commit is contained in:
Codex committed 2026-10-31 18:41:40 +08:00
1 parent bd8b58a6cf
commit add9ed489e
38 files changed
+512 -14

No files matched your search

@@ -0,0 +1,26 @@
<?php
namespace Tests\Unit;
use App\Services\ResourceArticlePresentation;
use PHPUnit\Framework\TestCase;
final class ResourceArticlePresentationTest extends TestCase
{
public function test_daily_resource_prompts_are_removed_without_changing_resource_markup(): void
{
$prompts = '<p><b><a href="https://t.me/clashfreenode">👉 点击加入我们的tg频道,每日获取最新节点与苹果账号。</a></b></p><p></p>'
.'<p><b><a href="https://github.com/example">👉 点击关注我们的github仓库,永不失联。</a></b></p><p></p>';
$resource = '<p><a data-clipboard-text="fixture-subscription">复制订阅</a></p><p>App Store 使用说明</p>';
foreach (['freenode', 'shadowrocketids'] as $category) {
self::assertSame($resource, ResourceArticlePresentation::body($prompts.$resource, $category));
}
self::assertSame($prompts.$resource, ResourceArticlePresentation::body($prompts.$resource, 'advanced'));
}
public function test_unrelated_github_and_telegram_links_are_kept(): void
{
$body = '<p>在 <a href="https://github.com/example">GitHub</a> 下载客户端。</p><p>Telegram 客户端教程</p>';
self::assertSame($body, ResourceArticlePresentation::body($body, 'freenode'));
}
}