Add PHPUnit test suite #75

Closed
opened 2026-06-23 13:32:23 +00:00 by jmiller · 1 comment
Owner

Summary

Create a comprehensive PHPUnit test suite covering the core logic of MokoSuiteOpenGraph.

Why

  • Currently zero automated tests — the biggest quality gap in the codebase
  • CI workflow (ci-joomla.yml) already has a test step but no tests to run
  • Critical for safe refactoring and schema expansion (v2.0 adds many JSON-LD types)

Test Coverage Priorities

  1. TagTable::check() — validation logic (OG types, robots, field truncation, content_type regex)
  2. JsonLdBuilder — all schema builders (Article, Product, WebPage, BreadcrumbList)
  3. ImageHelper::resize() — image processing, dimension detection, error handling
  4. ImportExportController — CSV parsing, validation, language handling
  5. BatchController — batch generation logic, limit enforcement
  6. MokoOGContent — form injection, save/delete, content_type mapping

Implementation

  • Add phpunit.xml.dist to project root
  • Create tests/Unit/ and tests/Integration/ directories
  • Mock Joomla framework dependencies (DatabaseInterface, Application, etc.)
  • Add PHPUnit to composer.json require-dev
  • Integrate with existing CI workflow
## Summary Create a comprehensive PHPUnit test suite covering the core logic of MokoSuiteOpenGraph. ## Why - Currently zero automated tests — the biggest quality gap in the codebase - CI workflow (`ci-joomla.yml`) already has a test step but no tests to run - Critical for safe refactoring and schema expansion (v2.0 adds many JSON-LD types) ## Test Coverage Priorities 1. **TagTable::check()** — validation logic (OG types, robots, field truncation, content_type regex) 2. **JsonLdBuilder** — all schema builders (Article, Product, WebPage, BreadcrumbList) 3. **ImageHelper::resize()** — image processing, dimension detection, error handling 4. **ImportExportController** — CSV parsing, validation, language handling 5. **BatchController** — batch generation logic, limit enforcement 6. **MokoOGContent** — form injection, save/delete, content_type mapping ## Implementation - Add `phpunit.xml.dist` to project root - Create `tests/Unit/` and `tests/Integration/` directories - Mock Joomla framework dependencies (DatabaseInterface, Application, etc.) - Add PHPUnit to `composer.json` require-dev - Integrate with existing CI workflow
jmiller added this to the Code Quality & Testing milestone 2026-06-23 13:32:23 +00:00
jmiller added the testing label 2026-06-23 13:32:23 +00:00
Author
Owner

Branch created: feature/75-add-phpunit-test-suite

git fetch origin
git checkout feature/75-add-phpunit-test-suite
Branch created: [`feature/75-add-phpunit-test-suite`](https://git.mokoconsulting.tech/MokoConsulting/MokoSuiteOpenGraph/src/branch/feature/75-add-phpunit-test-suite) ```bash git fetch origin git checkout feature/75-add-phpunit-test-suite ```
Sign in to join this conversation.
Priority Medium
Type Feature
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoSuiteOpenGraph#75