Skip to content

test(api): add appointment endpoint tests#12419

Open
miguelm-montano wants to merge 3 commits into
openemr:masterfrom
miguelm-montano:test/appointment-api-coverage
Open

test(api): add appointment endpoint tests#12419
miguelm-montano wants to merge 3 commits into
openemr:masterfrom
miguelm-montano:test/appointment-api-coverage

Conversation

@miguelm-montano

Copy link
Copy Markdown

Assisted-By: Claude Code

Short description of what this changes or resolves:

Adds API test coverage for the Standard REST Appointment resource, addressing gaps in the API test suite. Currently only 30/172 route+method combinations have tests.

Contributes to #12343

Changes proposed in this pull request:

  • Created tests/Tests/Api/AppointmentApiTest.php with tests for:
    • GET /api/appointment (list all appointments)
    • GET /api/appointment/:eid (get single appointment by ID)
    • Proper error handling (404 for missing ID, 401 for unauthorized)
    • Follows the FacilityApiTest pattern as suggested in the coverage gap issue

Coverage impact:

  • Before: 30/172 route+method combinations tested (17%)
  • After: 32/172 route+method combinations tested (18.6%)

Was an AI assistant used? Yes / No

Yes

@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 24.64%. Comparing base (32c99ba) to head (271448b).
⚠️ Report is 228 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #12419      +/-   ##
============================================
+ Coverage     24.17%   24.64%   +0.47%     
- Complexity    84094    84416     +322     
============================================
  Files          3934     3896      -38     
  Lines        417183   417456     +273     
============================================
+ Hits         100835   102894    +2059     
+ Misses       316348   314562    -1786     
Flag Coverage Δ
apache 15.39% <100.00%> (-0.16%) ⬇️
api 3.76% <100.00%> (-0.06%) ⬇️
api-tests 3.76% <100.00%> (-0.04%) ⬇️
e2e 8.88% <0.00%> (-0.55%) ⬇️
e2e-tests 8.88% <0.00%> (-0.55%) ⬇️
email 0.18% <0.00%> (-0.01%) ⬇️
isolated-php8.2 8.57% <0.00%> (+0.96%) ⬆️
isolated-php8.3 8.57% <0.00%> (+0.96%) ⬆️
isolated-php8.4 8.57% <0.00%> (+0.96%) ⬆️
isolated-php8.5 8.57% <0.00%> (+0.96%) ⬆️
isolated-php8.6 8.57% <0.00%> (+0.96%) ⬆️
mariadb10.11.18 ?
mariadb10.6.27 ?
mariadb11.4.12 ?
mariadb11.8.8 15.39% <100.00%> (-0.40%) ⬇️
mariadb12.2.2 ?
mysql5.7.44 ?
mysql8.0.46 ?
mysql8.4.9 ?
mysql9.3.0 ?
nginx ?
php8.2 15.39% <100.00%> (+3.05%) ⬆️
php8.3 ?
php8.4 ?
php8.5 ?
services 5.29% <0.00%> (+0.13%) ⬆️
upgrade ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a13b030-2fcd-4c3a-bdea-c18a702d3690

📥 Commits

Reviewing files that changed from the base of the PR and between 271448b and 7b81a63.

📒 Files selected for processing (1)
  • tests/Tests/Api/AppointmentApiTest.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/Tests/Api/AppointmentApiTest.php

📝 Walkthrough

Walkthrough

Adds a new PHPUnit test class AppointmentApiTest covering the appointment read API endpoints. It sets up an API client with auth, installs fixtures by POSTing a patient appointment to capture an event ID, and tears down fixtures after each test. Four test methods assert HTTP 200 for list and get-by-id, 404 for a missing ID, and 401 for unauthenticated requests.

Changes

Appointment API Test Suite

Layer / File(s) Summary
AppointmentApiTest class
tests/Tests/Api/AppointmentApiTest.php
New PHPUnit test class with setUp/tearDown fixture lifecycle and four test methods covering appointment list, get-by-id, not-found (404), and unauthorized (401) endpoint scenarios.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the change: adding appointment API endpoint tests.
Description check ✅ Passed The description accurately describes the new appointment API test coverage and related error cases.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant