Skip to content

Commit 24c6b12

Browse files
committed
Address review: align assertion naming and clarify docblocks
- Rename assertSymfonyVersion -> seeSymfonyVersion and assertEnvFileIsSynchronized -> seeEnvFileIsSynchronized to match the module's uniform see*/dontSee*/grab* convention - seeDoctrineDatabaseIsUp: document the entity-manager-name fallback - seeAppEnvAndDebugMatchKernel: document when APP_ENV/APP_DEBUG can legitimately diverge from the Kernel - Update unit test for the rename
1 parent afb9a63 commit 24c6b12

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

src/Codeception/Module/Symfony/DoctrineAssertionsTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ public function seeNumRecords(int $expectedNum, string $className, array $criter
120120
* $I->seeDoctrineDatabaseIsUp('custom');
121121
* ```
122122
*
123-
* @param non-empty-string $connectionName The name of the Doctrine connection to check.
123+
* @param non-empty-string $connectionName A Doctrine connection name; if no connection matches,
124+
* it is resolved as an entity manager name (whose connection is used).
124125
*/
125126
public function seeDoctrineDatabaseIsUp(string $connectionName = 'default'): void
126127
{

src/Codeception/Module/Symfony/EnvironmentAssertionsTrait.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ public function dontSeeDebugModeEnabled(): void
8282
*
8383
* ```php
8484
* <?php
85-
* $I->assertSymfonyVersion('>=', '6.4');
85+
* $I->seeSymfonyVersion('>=', '6.4');
8686
* ```
8787
*/
88-
public function assertSymfonyVersion(string $operator, string $version, string $message = ''): void
88+
public function seeSymfonyVersion(string $operator, string $version, string $message = ''): void
8989
{
9090
$this->assertTrue(
9191
version_compare(Kernel::VERSION, $version, $operator),
@@ -99,6 +99,10 @@ public function assertSymfonyVersion(string $operator, string $version, string $
9999
* Values are resolved in this order: `$_SERVER`, then `$_ENV`, then `getenv()`.
100100
* This helps validate both real OS variables and values resolved from `.env` files.
101101
*
102+
* The variables can legitimately diverge from the Kernel - for example when a shell
103+
* or CI job exports `APP_ENV=dev` while the test Kernel is booted in `test` - and this
104+
* assertion guards against that drift. Only variables that are actually present are checked.
105+
*
102106
* ```php
103107
* <?php
104108
* $I->seeAppEnvAndDebugMatchKernel();
@@ -212,14 +216,14 @@ public function seeProjectStructureIsSane(): void
212216
*
213217
* ```php
214218
* <?php
215-
* $I->assertEnvFileIsSynchronized();
219+
* $I->seeEnvFileIsSynchronized();
216220
* ```
217221
*
218222
* @param non-empty-string $envPath
219223
* @param non-empty-string $examplePath
220224
* @param list<non-empty-string> $additionalEnvPaths
221225
*/
222-
public function assertEnvFileIsSynchronized(string $envPath = '.env', string $examplePath = '.env.example', array $additionalEnvPaths = []): void
226+
public function seeEnvFileIsSynchronized(string $envPath = '.env', string $examplePath = '.env.example', array $additionalEnvPaths = []): void
223227
{
224228
$projectDir = $this->getProjectDir();
225229

tests/EnvironmentAssertionsTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ protected function tearDown(): void
6161
parent::tearDown();
6262
}
6363

64-
public function testAssertSymfonyVersionAcceptsOneTwoAndThreeSegments(): void
64+
public function testSeeSymfonyVersionAcceptsOneTwoAndThreeSegments(): void
6565
{
66-
$this->assertSymfonyVersion('>=', (string) Kernel::MAJOR_VERSION);
67-
$this->assertSymfonyVersion('>=', sprintf('%d.%d', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION));
68-
$this->assertSymfonyVersion('>=', sprintf('%d.%d.0', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION));
66+
$this->seeSymfonyVersion('>=', (string) Kernel::MAJOR_VERSION);
67+
$this->seeSymfonyVersion('>=', sprintf('%d.%d', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION));
68+
$this->seeSymfonyVersion('>=', sprintf('%d.%d.0', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION));
6969
}
7070

7171
public function testSeeAppEnvAndDebugMatchKernelUsesServerValues(): void

0 commit comments

Comments
 (0)