Skip to content

feat: add complete test suite for v1 endpoints#1093

Merged
ale23yfm merged 1 commit into
masterfrom
feat/v1-tests
Jun 20, 2026
Merged

feat: add complete test suite for v1 endpoints#1093
ale23yfm merged 1 commit into
masterfrom
feat/v1-tests

Conversation

@sebiboga

Copy link
Copy Markdown
Member

Changes

New: tests/ — complete test infrastructure

Unit Tests (plain PHP, no framework):

  • TestSolrEscape.php — escape caractere speciale Solr
  • TestAuth.phpmd5(company + cif), hash_equals()
  • TestValidation.php — input validation, length limits, confirmation
  • TestQueryBuild.php — construcție query-uri AND/OR cu escape

Integration Tests (mock Solr + PHP built-in server):

  • TestRandom.phpGET /v1/random/ (200, 405, field types)
  • TestEmpty.phpDELETE /v1/empty/ (200, 401, 405)
  • TestCleanjobs.phpDELETE /v1/cleanjobs/ (200, 400, 401, 404, 405, brand lookup)

E2E (after deploy, on api.peviitor.ro):

  • TestSmoke.php — smoke testing on production endpoints

HTML Report

  • Auto-generat în tests/generate-report.php
  • Summary + tabel colorat (✓/✗) cu badge-uri unit/int/e2e
  • FTP la api.peviitor.ro/tests/report.html

GitHub Actions

  • test-pr.yml — rulează unit + integration pe PR
  • test-deploy.yml — rulează după deploy (toate 3 + FTP report)

index.php

  • Badge 🧪 Test Report în header, link spre /tests/report.html

Closes

Closes #1092

- Unit tests: solrEscape, auth, validation, query building (plain PHP)
- Integration tests: mock Solr server, HTTP tests for all 3 endpoints
- E2E smoke tests: api.peviitor.ro (triggered after deploy)
- HTML report generator with badge + color-coded results
- GitHub Actions: test-pr.yml (PR), test-deploy.yml (post-deploy)
- FTP deploy of test report to api.peviitor.ro/tests/
- Badge link in documentation page
@ale23yfm ale23yfm merged commit afdca08 into master Jun 20, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit + integration + E2E tests for v1 endpoints

2 participants