4
4
5
5
use Codeception \Module ;
6
6
use Codeception \TestInterface ;
7
- use Nette \Caching \Storages \IJournal ;
7
+ use Nette \Caching \Storages \Journal ;
8
8
use Nette \Caching \Storages \SQLiteJournal ;
9
9
use Nette \Configurator ;
10
10
use Nette \DI \Container ;
@@ -23,6 +23,7 @@ class NetteDIModule extends Module
23
23
/** @var callable[] function(Container $container): void; */
24
24
public $ onCreateContainer = [];
25
25
26
+ /** @var array<string, mixed> */
26
27
protected array $ config = [
27
28
'configFiles ' => [],
28
29
'appDir ' => null ,
@@ -33,6 +34,7 @@ class NetteDIModule extends Module
33
34
'newContainerForEachTest ' => false ,
34
35
];
35
36
37
+ /** @var string[] */
36
38
protected array $ requiredFields = [
37
39
'tempDir ' ,
38
40
];
@@ -47,11 +49,13 @@ class NetteDIModule extends Module
47
49
private $ container ;
48
50
49
51
/**
50
- * @param mixed[] $settings
52
+ * @param array{path?: string} $settings
51
53
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
52
54
*/
53
- public function _beforeSuite ($ settings = []): void
55
+ public function _beforeSuite (array $ settings = []): void
54
56
{
57
+ assert (isset ($ settings ['path ' ]));
58
+
55
59
$ this ->path = rtrim ($ settings ['path ' ], '/ ' );
56
60
$ this ->clearTempDir ();
57
61
}
@@ -141,9 +145,10 @@ private function createContainer(): void
141
145
$ configurator ->setTempDirectory ($ tempDir );
142
146
143
147
if ($ this ->config ['debugMode ' ] !== null ) {
144
- $ configurator ->setDebugMode ($ this ->config ['debugMode ' ]);
148
+ $ configurator ->setDebugMode (( bool ) $ this ->config ['debugMode ' ]);
145
149
}
146
150
151
+ /** @var iterable<string> $configFiles */
147
152
$ configFiles = $ this ->configFiles !== [] ? $ this ->configFiles : $ this ->config ['configFiles ' ];
148
153
foreach ($ configFiles as $ file ) {
149
154
$ configurator ->addConfig (FileSystem::isAbsolute ($ file ) ? $ file : $ this ->path . '/ ' . $ file );
@@ -198,7 +203,7 @@ private function stopContainer(): void
198
203
}
199
204
200
205
try {
201
- $ journal = $ this ->container ->getByType (IJournal ::class);
206
+ $ journal = $ this ->container ->getByType (Journal ::class);
202
207
if ($ journal instanceof SQLiteJournal) {
203
208
$ property = new ReflectionProperty (SQLiteJournal::class, 'pdo ' );
204
209
$ property ->setAccessible (true );
0 commit comments