8000 Remove param flag from persistService function by TavoNiievez · Pull Request #71 · Codeception/module-symfony · GitHub
[go: up one dir, main page]

Skip to content

Remove param flag from persistService function #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions src/Codeception/Module/Symfony.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function _initialize()
$this->kernel->boot();

if ($this->config['cache_router'] === true) {
$this->persistService('router', true);
$this->persistPermanentService('router');
}
}

Expand Down Expand Up @@ -243,16 +243,16 @@ public function _getEntityManager()
}
if (!isset($this->permanentServices[$this->config['em_service']])) {
// try to persist configured EM
$this->persistService($this->config['em_service'], true);
$this->persistPermanentService($this->config['em_service']);

if ($this->_getContainer()->has('doctrine')) {
$this->persistService('doctrine', true);
$this->persistPermanentService('doctrine');
}
if ($this->_getContainer()->has('doctrine.orm.default_entity_manager')) {
$this->persistService('doctrine.orm.default_entity_manager', true);
$this->persistPermanentService('doctrine.orm.default_entity_manager');
}
if ($this->_getContainer()->has('doctrine.dbal.backend_connection')) {
$this->persistService('doctrine.dbal.backend_connection', true);
$this->persistPermanentService('doctrine.dbal.backend_connection');
}
}
return $this->permanentServices[$this->config['em_service']];
Expand Down Expand Up @@ -338,18 +338,29 @@ protected function getKernelClass()

/**
* Get service $serviceName and add it to the lists of persistent services.
* If $isPermanent then service becomes persistent between tests
*
* @param string $serviceName
* @param boolean $isPermanent
* @param string $serviceName
*/
public function persistService(string $serviceName, bool $isPermanent = false)
public function persistService(string $serviceName)
{
$service = $this->grabService($serviceName);
$this->persistentServices[$serviceName] = $service;
if ($isPermanent) {
$this->permanentServices[$serviceName] = $service;
if ($this->client) {
$this->client->persistentServices[$serviceName] = $service;
}
}

/**
* Get service $serviceName and add it to the lists of persistent services,
* making that service persistent between tests.
*
* @param string $serviceName
*/
public function persistPermanentService(string $serviceName)
{
$service = $this->grabService($serviceName);
$this->persistentServices[$serviceName] = $service;
$this->permanentServices[$serviceName] = $service;
if ($this->client) {
$this->client->persistentServices[$serviceName] = $service;
}
Expand Down
0