|
12 | 12 | namespace Gedmo\Tests\Tool;
|
13 | 13 |
|
14 | 14 | use Doctrine\Common\EventManager;
|
15 |
| -use Doctrine\DBAL\Driver; |
16 | 15 | use Doctrine\DBAL\DriverManager;
|
17 | 16 | use Doctrine\DBAL\Logging\Middleware;
|
18 | 17 | use Doctrine\ORM\Configuration;
|
@@ -41,8 +40,6 @@ abstract class BaseTestCaseORM extends TestCase
|
41 | 40 | {
|
42 | 41 | protected ?EntityManager $em = null;
|
43 | 42 |
|
44 |
| - protected QueryAnalyzer $queryAnalyzer; |
45 |
| - |
46 | 43 | protected QueryLogger $queryLogger;
|
47 | 44 |
|
48 | 45 | protected function setUp(): void
|
@@ -75,22 +72,6 @@ protected function getDefaultMockSqliteEntityManager(?EventManager $evm = null,
|
75 | 72 | return $this->em = $em;
|
76 | 73 | }
|
77 | 74 |
|
78 |
| - /** |
79 |
| - * TODO: Remove this method when dropping support of doctrine/dbal 2. |
80 |
| - * |
81 |
| - * Starts query statistic log |
82 |
| - * |
83 |
| - * @throws \RuntimeException |
84 |
| - */ |
85 |
| - protected function startQueryLog(): void |
86 |
| - { |
87 |
| - if (null === $this->em) { |
88 |
| - throw new \RuntimeException('EntityManager must be initialized.'); |
89 |
| - } |
90 |
| - $this->queryAnalyzer = new QueryAnalyzer($this->em->getConnection()->getDatabasePlatform()); |
91 |
| - $this->em->getConfiguration()->setSQLLogger($this->queryAnalyzer); |
92 |
| - } |
93 |
| - |
94 | 75 | /**
|
95 | 76 | * Creates default mapping driver
|
96 | 77 | */
|
@@ -118,13 +99,9 @@ protected function getDefaultConfiguration(): Configuration
|
118 | 99 | $config->setProxyDir(TESTS_TEMP_DIR);
|
119 | 100 | $config->setProxyNamespace('Proxy');
|
120 | 101 | $config->setMetadataDriverImpl($this->getMetadataDriverImplementation());
|
121 |
| - |
122 |
| - // TODO: Remove the "if" check when dropping support of doctrine/dbal 2. |
123 |
| - if (class_exists(Middleware::class)) { |
124 |
| - $config->setMiddlewares([ |
125 |
| - new Middleware($this->queryLogger), |
126 |
| - ]); |
127 |
| - } |
| 102 | + $config->setMiddlewares([ |
| 103 | + new Middleware($this->queryLogger), |
| 104 | + ]); |
128 | 105 |
|
129 | 106 | return $config;
|
130 | 107 | }
|
|
0 commit comments