Skip to content

Commit 4abdebf

Browse files
committed
add environment assertions trait and tests
1 parent 7afd4df commit 4abdebf

File tree

6 files changed

+668
-50
lines changed

6 files changed

+668
-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: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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 phpEnvironmentAssertions(FunctionalTester $I): void
18+
{
19+
$I->assertPhpDefaultTimezoneIs('UTC');
20+
}
21+
22+
public function symfonyKernelAssertions(FunctionalTester $I): void
23+
{
24+
$I->assertKernelEnvironment('test');
25+
$I->assertDebugModeIsEnabled();
26+
$I->assertSymfonyVersion('>=', '7.3');
27+
$I->assertAppEnvAndDebugMatchKernel();
28+
$I->assertAppCacheIsWritable();
29+
$I->assertProjectStructureIsSane();
30+
}
31+
32+
public function serviceAndBundleAssertions(FunctionalTester $I): void
33+
{
34+
$I->assertBundleIsEnabled(\Symfony\Bundle\FrameworkBundle\FrameworkBundle::class);
35+
}
36+
37+
public function securityAssertions(FunctionalTester $I): void
38+
{
39+
$I->assertFirewallIsActive('main');
40+
}
41+
42+
public function doctrineAssertions(FunctionalTester $I): void
43+
{
44+
$I->assertDoctrineDatabaseIsUp();
45+
}
46+
47+
public function otherComponentAssertions(FunctionalTester $I): void
48+
{
49+
$I->assertSessionSavePathIsWritable();
50+
$I->assertKernelCharsetIs('UTF-8');
51+
}
52+
}

0 commit comments

Comments
 (0)