• Mahmoud Aglan's avatar
    fix(training): make cancelling an enrolment actually work · 0d3d6a5c
    Mahmoud Aglan authored
    EnrollmentCancelled takes (enrolment, reason, actor). The service dispatched
    (enrolment, actor), so PHP put the User where the string reason was expected and
    found no third argument. dispatch() constructs the event before the dispatcher
    ever sees it, so this threw an ArgumentCountError on the line itself — inside
    the service's own DB::transaction, which then rolled the whole cancellation
    back.
    
    Every cancellation on every tenant failed this way. The row stayed active, the
    group count stayed high, and the nightly renewal run kept billing an enrolment
    the desk believed it had ended. The only symptom was an error page, and being
    ShouldDispatchAfterCommit made no difference — the object is built at dispatch,
    not at commit.
    
    Found while removing three test participants from a live tenant: the cleanup
    could not cancel their enrolments.
    
    Pinned by a test that cancels a real enrolment against a restored tenant and
    asserts it reaches 'cancelled' — which is the whole proof, since a wrong
    argument list cannot get that far. Event::fake is deliberately not used: it
    would assert nothing here, because the event is correctly withheld until a
    commit the test rolls back. A second test pins the event's parameter names so
    the contract is caught even with no tenant to run against.
    Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
    0d3d6a5c
Name
Last commit
Last update
Screenshots Loading commit data...
app Loading commit data...
bootstrap Loading commit data...
config Loading commit data...
database Loading commit data...
docker Loading commit data...
docs Loading commit data...
docs-site Loading commit data...
flutter_shell Loading commit data...
gap-filling-plans Loading commit data...
lang Loading commit data...
marketing-site Loading commit data...
plans Loading commit data...
public Loading commit data...
reference/oc-sport Loading commit data...
resources Loading commit data...
routes Loading commit data...
scripts Loading commit data...
storage Loading commit data...
tests Loading commit data...
.dockerignore Loading commit data...
.editorconfig Loading commit data...
.env.example Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.npmrc Loading commit data...
Beanding Guide.txt Loading commit data...
CLAUDE.md Loading commit data...
Dockerfile Loading commit data...
README.md Loading commit data...
artisan Loading commit data...
captain-definition Loading commit data...
composer.json Loading commit data...
composer.lock Loading commit data...
deploy.sh Loading commit data...
elcaptain-sportsonly-db.md Loading commit data...
one-click-app.yml Loading commit data...
package-lock.json Loading commit data...
package.json Loading commit data...
phpunit.xml Loading commit data...
system info.txt Loading commit data...
vite.config.js Loading commit data...
نادى الشيخ زايد كشف بيانات اللاعبين (2).html Loading commit data...