Skip to content

Commit b8ef1ad

Browse files
committed
Simplify Nette module
1 parent 2016520 commit b8ef1ad

File tree

2 files changed

+3
-30
lines changed

2 files changed

+3
-30
lines changed

src/Module/Nette.php

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
namespace Arachne\Codeception\Module;
1212

1313
use Arachne\Codeception\Connector\Nette as NetteConnector;
14+
use Arachne\Codeception\Module\Container as ContainerModule;
1415
use Codeception\Lib\Framework;
1516
use Codeception\TestCase;
16-
use Nette\Configurator;
1717
use Nette\DI\Container;
1818
use Nette\DI\MissingServiceException;
1919
use Nette\Utils\FileSystem;
@@ -25,14 +25,6 @@ class Nette extends Framework
2525
{
2626
protected $config = [
2727
'followRedirects' => true,
28-
'configFiles' => [],
29-
'logDir' => null,
30-
'debugMode' => null,
31-
'configurator' => Configurator::class,
32-
];
33-
34-
protected $requiredFields = [
35-
'tempDir',
3628
];
3729

3830
/**
@@ -66,27 +58,7 @@ public function _before(TestCase $test)
6658
$this->container = null;
6759
$this->containerAccessor = function () {
6860
if (!$this->container) {
69-
$configurator = new $this->config['configurator']();
70-
71-
if ($this->config['logDir']) {
72-
$configurator->enableDebugger($this->path.'/'.$this->config['logDir']);
73-
}
74-
75-
$tempDir = $this->path.'/'.$this->config['tempDir'];
76-
FileSystem::delete($tempDir);
77-
FileSystem::createDir($tempDir);
78-
$configurator->setTempDirectory($tempDir);
79-
80-
if ($this->config['debugMode'] !== null) {
81-
$configurator->setDebugMode($this->config['debugMode']);
82-
}
83-
84-
$configFiles = is_array($this->configFiles) ? $this->configFiles : $this->config['configFiles'];
85-
foreach ($configFiles as $file) {
86-
$configurator->addConfig($this->path.'/'.$file, false);
87-
}
88-
89-
$this->container = $configurator->createContainer();
61+
$this->container = $this->getModule(ContainerModule::class)->createContainer();
9062
}
9163

9264
return $this->container;

tests/integration.suite.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ modules:
66
enabled:
77
- Arachne\Codeception\Module\Nette:
88
followRedirects: false
9+
- Arachne\Codeception\Module\Container:
910
configurator: Arachne\Bootstrap\Configurator
1011
tempDir: ../_temp/integration
1112
configFiles:

0 commit comments

Comments
 (0)