Skip to content

Add module-specific assertions (Doctrine, Environment, Security, Session) - #246

Draft
TavoNiievez wants to merge 1 commit into
Codeception:mainfrom
TavoNiievez:new_asserts
Draft

Add module-specific assertions (Doctrine, Environment, Security, Session)#246
TavoNiievez wants to merge 1 commit into
Codeception:mainfrom
TavoNiievez:new_asserts

Conversation

@TavoNiievez

Copy link
Copy Markdown
Member

What

Adds high-level, actor-style assertions that rely on Symfony kernel/container integration and have no pure-Symfony equivalent. These belong to the see* / dontSee* family of the naming convention documented in CONTRIBUTING.md (also extended here).

Methods

  • DoctrineAssertionsTrait: seeDoctrineDatabaseIsUp, seeDoctrineSchemaIsValid, seeDoctrineProxyDirIsWritable
  • EnvironmentAssertionsTrait (new trait): seeKernelEnvironmentIs, seeDebugModeEnabled, dontSeeDebugModeEnabled, seeSymfonyVersion, seeAppEnvAndDebugMatchKernel, seeAppCacheIsWritable, seeAppLogIsWritable, seeProjectStructureIsSane, seeEnvFileIsSynchronized, seeBundleIsEnabled, seeAssetManifestExists, seeKernelCharsetIs
  • SecurityAssertionsTrait: seeFirewallIsConfigured, seeRoleInHierarchy, seeSecretCanBeResolved
  • SessionAssertionsTrait: seeSessionSavePathIsWritable

Registers EnvironmentAssertionsTrait on the Symfony module facade and documents the see* / assert* naming convention in CONTRIBUTING.md.

Tests

Unit tests added for the methods exercisable against the test app (tests/_app): Doctrine checks, the firewall check, Symfony-version/env-debug/project-dir environment checks.

The remaining checks require a full real Symfony project layout that the mini unit-test app does not provide (seeProjectStructureIsSane, seeAssetManifestExists, seeEnvFileIsSynchronized, seeSecretCanBeResolved); per the two-test-layer setup these are best covered in the companion Codeception/symfony-module-tests functional suite.

Notes

Companion to #240, which contains the Symfony-mirroring assert* / get* assertions. The two PRs touch disjoint files and can be reviewed/merged independently.

@ThomasLandauer

Copy link
Copy Markdown
Member

This PR replaces #218

…ion)

Add high-level, actor-style assertions that rely on Symfony kernel and
container integration and have no pure-Symfony equivalent. They belong to
the see* / dontSee* family of the naming convention documented in
CONTRIBUTING.md, which is extended here.

- DoctrineAssertionsTrait: seeDoctrineDatabaseIsUp, seeDoctrineSchemaIsValid,
  seeDoctrineProxyDirIsWritable
- EnvironmentAssertionsTrait (new): seeKernelEnvironmentIs,
  seeDebugModeEnabled, dontSeeDebugModeEnabled, seeSymfonyVersion,
  seeAppEnvAndDebugMatchKernel, seeAppCacheIsWritable, seeAppLogIsWritable,
  seeProjectStructureIsSane, seeEnvFileIsSynchronized, seeBundleIsEnabled,
  seeAssetManifestExists, seeKernelCharsetIs
- SecurityAssertionsTrait: seeFirewallIsConfigured, seeRoleInHierarchy,
  seeSecretCanBeResolved
- SessionAssertionsTrait: seeSessionSavePathIsWritable

Register EnvironmentAssertionsTrait on the Symfony module facade and
document the see* / assert* naming convention in CONTRIBUTING.md.

Unit tests cover the methods exercisable against the test app under
tests/_app. The remaining checks need a full Symfony project layout that the
mini test app does not provide (seeProjectStructureIsSane,
seeAssetManifestExists, seeEnvFileIsSynchronized, seeSecretCanBeResolved);
per the two-layer test setup those belong in the companion
Codeception/symfony-module-tests functional suite.

Also stop the functional CI job from installing a second copy of the module
into the app: it removed codeception/module-symfony with --no-update and
then ran `composer install`, which reinstalls from the app's lockfile, so
the module source under test and a stale released copy were both
autoloaded.
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.

2 participants