Skip to content

Add functional tests for schema validation and voter assertions - #75

Merged
TavoNiievez merged 1 commit into
Codeception:8.1from
TavoNiievez:8.1-new-assertions-tests
Sep 4, 2026
Merged

Add functional tests for schema validation and voter assertions#75
TavoNiievez merged 1 commit into
Codeception:8.1from
TavoNiievez:8.1-new-assertions-tests

Conversation

@TavoNiievez

Copy link
Copy Markdown
Member

Adds functional coverage for the assertions introduced in Codeception/module-symfony#246:

  • seeDoctrineSchemaIsValid()
  • seeUserIsGranted() / dontSeeUserIsGranted()

The application gains a UserVoter that grants USER_EDIT only on the account of the
authenticated user, so the security assertions run against a real voter with a subject
instead of a plain role check. It implements VoterInterface rather than extending
Voter, whose abstract voteOnAttribute() signature is not the same across the Symfony
versions covered by the branches of this repository.

Verification

These tests need a codeception/module-symfony revision containing #246, which is not in
its main yet, so CI on this pull request fails until that one is merged and
composer.lock here is refreshed.

They were verified on a fork branch identical to this one except for a composer.lock
pointing at the #246 head (d83f581):

  • Symfony 8.1 on PHP 8.4 and 8.5: run 33827880283 — green, 146 tests, 286 assertions

The three new tests in that run:

DoctrineCest: See doctrine schema is valid
SecurityCest: See user is granted
SecurityCest: Dont see user is granted

composer.lock on 8.1 currently pins a dev-main revision that predates #247, so
mockService, seeMessengerQueueCount, seeNumQueriesIsLessThan and
assertSessionHasFlashMessage already fail on this branch today. A single
composer update codeception/module-symfony once #246 is merged clears both that and this
pull request.

Cover seeDoctrineSchemaIsValid(), seeUserIsGranted() and dontSeeUserIsGranted()
from Codeception/module-symfony#246. They pass once composer.lock points at a
module-symfony revision containing that pull request.

The application gains a UserVoter that grants USER_EDIT only on the account of
the authenticated user, so the new assertions run against a real voter instead
of a plain role check. It implements VoterInterface rather than extending
Voter, whose abstract voteOnAttribute() signature is not the same across the
Symfony versions covered by the branches of this repository.
@TavoNiievez
TavoNiievez merged commit 031aae8 into Codeception:8.1 Sep 4, 2026
0 of 2 checks passed
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