Skip to content

Commit 0e0828a

Browse files
committed
add environment assertions trait and tests
1 parent 7afd4df commit 0e0828a

File tree

6 files changed

+650
-50
lines changed

6 files changed

+650
-50
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@
7070
},
7171
"autoload-dev": {
7272
"psr-4": {
73-
"App\\Tests\\": "tests/"
73+
"App\\Tests\\": "tests/",
74+
"Codeception\\Module\\Symfony\\": "tests/Support/Codeception/Module/Symfony/"
7475
}
7576
},
7677
"replace": {

composer.lock

Lines changed: 51 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Functional.suite.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ modules:
99
- Doctrine:
1010
depends: Symfony
1111
cleanup: true
12+
- App\Tests\Support\Helper\Environment
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Tests\Functional;
6+
7+
use App\Tests\Support\FunctionalTester;
8+
9+
class EnvironmentAssertionsCest
10+
{
11+
public function _before(): void
12+
{
13+
@mkdir(codecept_root_dir() . 'var/log', 0777, true);
14+
@mkdir(codecept_root_dir() . 'var/sessions/test', 0777, true);
15+
}
16+
17+
public function symfonyKernelAssertions(FunctionalTester $I): void
18+
{
19+
$I->assertKernelEnvironment('test');
20+
$I->assertDebugModeIsEnabled();
21+
$I->assertSymfonyVersion('>=', '7.3');
22+
$I->assertAppEnvAndDebugMatchKernel();
23+
$I->assertAppCacheIsWritable();
24+
$I->assertProjectStructureIsSane();
25+
}
26+
27+
public function serviceAndBundleAssertions(FunctionalTester $I): void
28+
{
29+
$I->assertBundleIsEnabled(\Symfony\Bundle\FrameworkBundle\FrameworkBundle::class);
30+
}
31+
32+
public function securityAssertions(FunctionalTester $I): void
33+
{
34+
$I->assertFirewallIsActive('main');
35+
}
36+
37+
public function doctrineAssertions(FunctionalTester $I): void
38+
{
39+
$I->assertDoctrineDatabaseIsUp();
40+
}
41+
42+
public function otherComponentAssertions(FunctionalTester $I): void
43+
{
44+
$I->assertSessionSavePathIsWritable();
45+
$I->assertKernelCharsetIs('UTF-8');
46+
}
47+
}

0 commit comments

Comments
 (0)