| | 62 | |
| | 63 | == 3. Venue Availability Function Test == |
| | 64 | |
| | 65 | === SQL Code === |
| | 66 | |
| | 67 | <syntaxhighlight lang="sql"> |
| | 68 | SELECT is_venue_available( |
| | 69 | 1, |
| | 70 | '2026-06-20', |
| | 71 | '18:00', |
| | 72 | '22:00' |
| | 73 | ); |
| | 74 | </syntaxhighlight> |
| | 75 | |
| | 76 | === Expected Result === |
| | 77 | |
| | 78 | Returns FALSE if the venue already has a conflicting booking. |
| | 79 | |
| | 80 | == 4. Photographer Availability Function Test == |
| | 81 | |
| | 82 | === SQL Code === |
| | 83 | |
| | 84 | <syntaxhighlight lang="sql"> |
| | 85 | SELECT is_photographer_available( |
| | 86 | 1, |
| | 87 | '2026-06-20', |
| | 88 | '18:00', |
| | 89 | '22:00' |
| | 90 | ); |
| | 91 | </syntaxhighlight> |
| | 92 | |
| | 93 | === Expected Result === |
| | 94 | |
| | 95 | Returns FALSE if the photographer already has a conflicting booking. |
| | 96 | |
| | 97 | == 5. Wedding Financial Summary View Test == |
| | 98 | |
| | 99 | === SQL Code === |
| | 100 | |
| | 101 | <syntaxhighlight lang="sql"> |
| | 102 | SELECT * |
| | 103 | FROM vw_wedding_financial_summary; |
| | 104 | </syntaxhighlight> |
| | 105 | |
| | 106 | === Expected Result === |
| | 107 | |
| | 108 | Displays wedding budget information, total booking expenses, and remaining budget calculations. |
| | 109 | |
| | 110 | == 6. RSVP Overview View Test == |
| | 111 | |
| | 112 | === SQL Code === |
| | 113 | |
| | 114 | <syntaxhighlight lang="sql"> |
| | 115 | SELECT * |
| | 116 | FROM vw_rsvp_overview; |
| | 117 | </syntaxhighlight> |
| | 118 | |
| | 119 | === Expected Result === |
| | 120 | |
| | 121 | Displays grouped RSVP statistics for guests and events. |
| | 122 | |
| | 123 | == 7. Constraint Validation Test == |
| | 124 | |
| | 125 | === SQL Code === |
| | 126 | |
| | 127 | <syntaxhighlight lang="sql"> |
| | 128 | INSERT INTO event_rsvp( |
| | 129 | guest_id, |
| | 130 | event_id, |
| | 131 | status |
| | 132 | ) |
| | 133 | VALUES ( |
| | 134 | 1, |
| | 135 | 1, |
| | 136 | 'invalid_status' |
| | 137 | ); |
| | 138 | </syntaxhighlight> |
| | 139 | |
| | 140 | === Expected Result === |
| | 141 | |
| | 142 | The CHECK constraint rejects invalid RSVP status values. |
| | 143 | |
| | 144 | == Summary == |
| | 145 | |
| | 146 | The testing scenarios confirm that the implemented trigger functions, SQL functions, views, and constraints operate correctly and enforce the required business rules inside the PostgreSQL database layer. |
| | 147 | |
| | 148 | The validation process demonstrates successful conflict prevention, integrity enforcement, and analytical reporting functionality for the Wedding Planner Management System. |