feat(17-03): sitemap plugin tracer, /sitemap.xml byte-identical to PHP

- golem15.sitemap plugin: golem15_sitemap_definitions migration, Definition
  model (Fillable theme and data) with tolerant PHP-shaped item decoding and
  PHP toArray item encoding
- Url::to and buildUrl port, libxml-format serializer, generator for url and
  registry items
- GET /sitemap.xml serves the definition with theme default (404 without one,
  empty body without items)
- tests/php/gen-goldens.php and the tracer golden; TestSitemapGolden and the
  Postgres TestSitemapTracer
This commit is contained in:
2026-10-12 16:53:09 +02:00
commit fe39e26ce0
20 changed files with 2742 additions and 0 deletions

3
classes/testdata/tracer.golden vendored Normal file
View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://api.example.test/sitemap.xsl"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"><url><loc>https://api.example.test/</loc><changefreq>always</changefreq><priority>1.0</priority></url><url><loc>https://api.example.test/news/hello</loc><lastmod>2026-03-04T10:00:00+00:00</lastmod><changefreq>weekly</changefreq><priority>0.5</priority><xhtml:link rel="alternate" hreflang="pl" href="https://api.example.test/news/hello"/><xhtml:link rel="alternate" hreflang="en" href="https://api.example.test/en/news/hello"/></url></urlset>

18
classes/testdata/tracer.json vendored Normal file
View File

@@ -0,0 +1,18 @@
{
"case": {
"root": "https://api.example.test",
"items": [
{"type": "url", "url": "/", "changefreq": "always", "priority": "1.0", "nesting": "0"},
{"type": "acme-post", "reference": "7", "urlPattern": "", "changefreq": "weekly", "priority": "0.5", "nesting": "1"}
],
"types": {
"acme-post": {
"7": {
"url": "/news/hello",
"mtime": "2026-03-04T10:00:00+00:00",
"alternates": [["pl", "/news/hello"], ["en", "/en/news/hello"]]
}
}
}
}
}