test: unit tests for pure JsonLdBuilder methods (#33 partial) #113

Open
jmiller wants to merge 1 commits from test/jsonld-unit-33 into dev
Owner

Partial progress on #33 — adds unit tests for the JsonLdBuilder helpers that are pure (no Factory/Uri/DB) and therefore run under the existing minimal bootstrap.

  • JsonLdBuilderLocalBusinessTestbuildLocalBusiness(): null without name, minimal schema omits optional keys, custom @type + partial address, geo only when both coordinates present.
  • JsonLdScriptTagTesttoScriptTag(): wraps in application/ld+json, rewrites </<\/ (XSS breakout prevention), and produces valid JSON after unescaping.

Note

Assertions were derived directly from the implementations and php -l is clean, but I could not run PHPUnit locally (no vendor/). Please let the CI test job confirm green before merging.

The remaining #33 targets (ImageHelper resize/validate, BatchController extract*, CSV import parsing, content/system plugin integration round-trips) require a Joomla test harness with DB/app mocking and are out of scope for this pure-unit pass — leaving #33 open.

Refs #33.

🤖 Generated with Claude Code

Partial progress on #33 — adds unit tests for the JsonLdBuilder helpers that are pure (no `Factory`/`Uri`/DB) and therefore run under the existing minimal bootstrap. - **`JsonLdBuilderLocalBusinessTest`** — `buildLocalBusiness()`: null without name, minimal schema omits optional keys, custom `@type` + partial address, geo only when both coordinates present. - **`JsonLdScriptTagTest`** — `toScriptTag()`: wraps in `application/ld+json`, rewrites `</` → `<\/` (XSS breakout prevention), and produces valid JSON after unescaping. ### Note Assertions were derived directly from the implementations and `php -l` is clean, but I could **not** run PHPUnit locally (no `vendor/`). Please let the CI `test` job confirm green before merging. The remaining #33 targets (ImageHelper resize/validate, BatchController extract*, CSV import parsing, content/system plugin integration round-trips) require a Joomla test harness with DB/app mocking and are out of scope for this pure-unit pass — leaving #33 open. Refs #33. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jmiller added 1 commit 2026-06-29 15:53:47 +00:00
test: add unit tests for pure JsonLdBuilder methods (#33 partial)
Universal: PR Check / Branch Policy (pull_request) Successful in 2s
Universal: PR Check / Validate PR (pull_request) Failing after 4s
Universal: PR Check / Secret Scan (pull_request) Successful in 5s
Generic: Project CI / Lint & Validate (pull_request) Successful in 11s
Joomla: Metadata Validation / Validate Joomla Metadata (pull_request) Failing after 28s
Generic: Project CI / Tests (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
903d4d37c8
- JsonLdBuilderLocalBusinessTest: buildLocalBusiness() null/minimal/custom-type/
  partial-address/geo-requires-both-coords cases
- JsonLdScriptTagTest: toScriptTag() wraps in ld+json, escapes </ to prevent
  </script> breakout, and produces valid JSON after unescaping

Covers the pure (Factory/Uri/DB-free) helpers that run under the existing
minimal bootstrap. The remaining #33 targets (ImageHelper, BatchController,
CSV import, content/system plugin integration) need a Joomla test harness.
Some required checks failed
Universal: PR Check / Branch Policy (pull_request) Successful in 2s
Universal: PR Check / Validate PR (pull_request) Failing after 4s
Universal: PR Check / Secret Scan (pull_request) Successful in 5s
Generic: Project CI / Lint & Validate (pull_request) Successful in 11s
Joomla: Metadata Validation / Validate Joomla Metadata (pull_request) Failing after 28s
Generic: Project CI / Tests (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
You are not authorized to merge this pull request.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin test/jsonld-unit-33:test/jsonld-unit-33
git checkout test/jsonld-unit-33
Sign in to join this conversation.
No Reviewers
Priority -
Type -
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoSuiteOpenGraph#113