Files
cms-website/tests/fixtures/README.md
T

1.6 KiB
Raw Blame History

tests/fixtures 测试夹具

来源声明

本目录所有夹具内容均为完全虚构:域名一律为 fixture.example,文章、产品、 分类、附件、SEO 文案等均为手写编造,不包含任何来自真实站点(如 hesupipe) 的数据,也未复制 storage/wxr/ 下的任何真实导出内容。

目录说明

  • wxr/mini.xml:最小 WXR(WordPress eXtended RSS)导出夹具。
  • sitemap/mini-sitemap.xml:最小 sitemap 夹具。
  • media/:1×1 PNG 媒体占位(fixture-a.png、fixture-b.png), 命名与 WXR 中 attachment 的 wp:attachment_url 对应。

覆盖的结构变体

wxr/mini.xml 覆盖阶段 2 WXR 流式解析器需要处理的结构:

  • .html 后缀 permalink 与目录式 permalink 混用
  • Yoast SEO meta(_yoast_wpseo_title、_yoast_wpseo_metadesc)
  • 特色图(_thumbnail_id)与产品图库(_product_image_gallery)
  • PHP serialized postmeta(wppop_sections,串内长度前缀为合法 PHP 序列化:s:8:"SpecsTab"、s:10:"<p>Tab</p>")
  • 故意的悬空引用:_product_image_gallery=203,204 引用的附件 ID 在夹具中不存在(只有 201/202)——用于阶段 2 测试"图库引用缺失→报告不崩溃"路径
  • wp:term(category / product_cat 两种 taxonomy)
  • attachment 条目(wp:attachment_url、status=inherit)
  • post / product(CPT) / page 多种 post_type

用途

这些夹具是阶段 2 WXR 流式解析器与 sitemap 解析的标准测试输入(契约输入), 内容视为契约,修改需同步更新相关测试。