Skip to content

Commit

Permalink
remove database creator and nextras dbal bridge (moved to database cr…
Browse files Browse the repository at this point in the history
…eator)
  • Loading branch information
matej21 committed Mar 14, 2018
1 parent f268f89 commit 4c1565e
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 124 deletions.
36 changes: 0 additions & 36 deletions src/Bridges/Database/DatabaseCreatorHook.php

This file was deleted.

18 changes: 0 additions & 18 deletions src/Bridges/NextrasDbal/NextrasDbalHook.php

This file was deleted.

28 changes: 0 additions & 28 deletions src/Bridges/NextrasDbal/NextrasDbalServiceHelpers.php

This file was deleted.

42 changes: 0 additions & 42 deletions src/MangoTesterExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@

namespace Mangoweb\Tester\Infrastructure;

use MangoShopTests\NextrasDbalServiceHelpers;
use Mangoweb\Tester\DatabaseCreator\DatabaseCreator;
use Mangoweb\Tester\Infrastructure\Bridges\Database\DatabaseCreatorHook;
use Mangoweb\Tester\Infrastructure\Bridges\Mockery\MockeryContainerHook;
use Mangoweb\Tester\Infrastructure\Bridges\NextrasDbal\NextrasDbalHook;
use Mangoweb\Tester\Infrastructure\Container\AppContainerFactory;
use Nette;
use Nette\DI\CompilerExtension;
use Nette\DI\Container;
use Nette\DI\Statement;
use Nextras\Dbal\Connection;
use Nextras\Dbal\IConnection;


class MangoTesterExtension extends CompilerExtension
Expand All @@ -24,16 +18,12 @@ class MangoTesterExtension extends CompilerExtension
public $defaults = [
'hooks' => [],
'require' => [],
'databaseCreator' => FALSE,
'nextrasDbal' => FALSE,
'mockery' => FALSE,
];


public function __construct()
{
$this->defaults['databaseCreator'] = class_exists(DatabaseCreator::class);
$this->defaults['nextrasDbal'] = class_exists(Connection::class);
$this->defaults['mockery'] = class_exists(\Mockery::class);
}

Expand All @@ -60,14 +50,6 @@ public function loadConfiguration()
->setClass(TestContext::class)
->setDynamic(TRUE);

if ($config['databaseCreator'] !== FALSE) {
$this->setupDatabaseCreator();
}

if ($config['nextrasDbal'] !== FALSE) {
$this->setupNextrasDbal();
}

if ($config['mockery'] !== FALSE) {
$builder->addDefinition($this->prefix('mockeryContainerHook'))
->setClass(MockeryContainerHook::class)
Expand Down Expand Up @@ -116,30 +98,6 @@ protected function registerRequiredServices(array $requiredServices): void
}


protected function setupNextrasDbal(): void
{
$builder = $this->getContainerBuilder();
$builder->addDefinition($this->prefix('nextrasDbalHook'))
->setClass(NextrasDbalHook::class)
->addTag(self::TAG_HOOK);

$serviceName = $builder->getByType(IConnection::class);
$def = $serviceName ? $builder->getDefinition($serviceName) : NULL;
if ($def && !isset($def->getTags()[self::TAG_REQUIRE])) {
NextrasDbalServiceHelpers::modifyConnectionDefinition($def);
}
}


protected function setupDatabaseCreator(): void
{
$builder = $this->getContainerBuilder();
$builder->addDefinition($this->prefix('createDatabaseHook'))
->setClass(DatabaseCreatorHook::class)
->addTag(self::TAG_HOOK);
}


private function requireService(string $class)
{
$builder = $this->getContainerBuilder();
Expand Down

0 comments on commit 4c1565e

Please sign in to comment.