Create PHPUnit test suite #132

Open
opened 2026-06-21 15:50:06 +00:00 by jmiller · 0 comments
Owner

Summary

The project has no automated tests. composer.json lists phpunit in require-dev but there is no tests/ directory, no phpunit.xml, and no test files.

Proposed test structure

tests/
├── phpunit.xml
├── bootstrap.php
├── Unit/
│   ├── Helper/
│   │   ├── CrossPostDispatcherTest.php
│   │   ├── QueueProcessorTest.php
│   │   ├── CredentialHelperTest.php
│   │   ├── OAuthHelperTest.php
│   │   ├── ServiceIconHelperTest.php
│   │   └── MigrationHelperTest.php
│   ├── Model/
│   │   ├── ServiceModelTest.php
│   │   ├── PostModelTest.php
│   │   └── TemplateModelTest.php
│   ├── Table/
│   │   ├── ServiceTableTest.php
│   │   ├── PostTableTest.php
│   │   └── TemplateTableTest.php
│   └── Service/
│       └── ServiceInterfaceTest.php
├── Integration/
│   ├── ServicePlugin/
│   │   └── (per-plugin publish/validate tests with mocked HTTP)
│   └── QueueProcessingTest.php

Priority areas for testing

  1. QueueProcessor — complex logic with locking, retries, evergreen processing
  2. CrossPostDispatcher — template rendering, category rules, duplicate guard
  3. CredentialHelper — encryption/decryption, field mapping
  4. OAuthHelper — token refresh logic, validation
  5. ServiceTable::check() — alias generation, required fields, timestamps
  6. Service plugins — mock HTTP responses, verify correct API calls

Acceptance Criteria

  • phpunit.xml configured with test suites
  • Bootstrap file that mocks Joomla framework basics
  • Unit tests for all Helper classes
  • Unit tests for Table check/bind logic
  • At least one service plugin integration test with mocked HTTP
  • make test target added to Makefile
  • Tests pass in CI
## Summary The project has no automated tests. `composer.json` lists `phpunit` in `require-dev` but there is no `tests/` directory, no `phpunit.xml`, and no test files. ## Proposed test structure ``` tests/ ├── phpunit.xml ├── bootstrap.php ├── Unit/ │ ├── Helper/ │ │ ├── CrossPostDispatcherTest.php │ │ ├── QueueProcessorTest.php │ │ ├── CredentialHelperTest.php │ │ ├── OAuthHelperTest.php │ │ ├── ServiceIconHelperTest.php │ │ └── MigrationHelperTest.php │ ├── Model/ │ │ ├── ServiceModelTest.php │ │ ├── PostModelTest.php │ │ └── TemplateModelTest.php │ ├── Table/ │ │ ├── ServiceTableTest.php │ │ ├── PostTableTest.php │ │ └── TemplateTableTest.php │ └── Service/ │ └── ServiceInterfaceTest.php ├── Integration/ │ ├── ServicePlugin/ │ │ └── (per-plugin publish/validate tests with mocked HTTP) │ └── QueueProcessingTest.php ``` ## Priority areas for testing 1. **QueueProcessor** — complex logic with locking, retries, evergreen processing 2. **CrossPostDispatcher** — template rendering, category rules, duplicate guard 3. **CredentialHelper** — encryption/decryption, field mapping 4. **OAuthHelper** — token refresh logic, validation 5. **ServiceTable::check()** — alias generation, required fields, timestamps 6. **Service plugins** — mock HTTP responses, verify correct API calls ## Acceptance Criteria - [ ] `phpunit.xml` configured with test suites - [ ] Bootstrap file that mocks Joomla framework basics - [ ] Unit tests for all Helper classes - [ ] Unit tests for Table check/bind logic - [ ] At least one service plugin integration test with mocked HTTP - [ ] `make test` target added to Makefile - [ ] Tests pass in CI
Sign in to join this conversation.
No labels
Priority Medium
Type Feature
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoSuiteCross#132