Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like AbstractDoctrineExtensionTest often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use AbstractDoctrineExtensionTest, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
23 | abstract class AbstractDoctrineExtensionTest extends TestCase |
||
24 | { |
||
25 | abstract protected function loadFromFile(ContainerBuilder $container, $file); |
||
|
|||
26 | |||
27 | public function testDbalLoadFromXmlMultipleConnections() |
||
28 | { |
||
29 | $container = $this->loadContainer('dbal_service_multiple_connections'); |
||
30 | |||
31 | // doctrine.dbal.mysql_connection |
||
32 | $config = $container->getDefinition('doctrine.dbal.mysql_connection')->getArgument(0); |
||
33 | |||
34 | $this->assertEquals('mysql_s3cr3t', $config['password']); |
||
35 | $this->assertEquals('mysql_user', $config['user']); |
||
36 | $this->assertEquals('mysql_db', $config['dbname']); |
||
37 | $this->assertEquals('/path/to/mysqld.sock', $config['unix_socket']); |
||
38 | |||
39 | // doctrine.dbal.sqlite_connection |
||
40 | $config = $container->getDefinition('doctrine.dbal.sqlite_connection')->getArgument(0); |
||
41 | $this->assertSame('pdo_sqlite', $config['driver']); |
||
42 | $this->assertSame('sqlite_db', $config['dbname']); |
||
43 | $this->assertSame('sqlite_user', $config['user']); |
||
44 | $this->assertSame('sqlite_s3cr3t', $config['password']); |
||
45 | $this->assertSame('/tmp/db.sqlite', $config['path']); |
||
46 | $this->assertTrue($config['memory']); |
||
47 | |||
48 | // doctrine.dbal.oci8_connection |
||
49 | $config = $container->getDefinition('doctrine.dbal.oci_connection')->getArgument(0); |
||
50 | $this->assertSame('oci8', $config['driver']); |
||
51 | $this->assertSame('oracle_db', $config['dbname']); |
||
52 | $this->assertSame('oracle_user', $config['user']); |
||
53 | $this->assertSame('oracle_s3cr3t', $config['password']); |
||
54 | $this->assertSame('oracle_service', $config['servicename']); |
||
55 | $this->assertTrue($config['service']); |
||
56 | $this->assertTrue($config['pooled']); |
||
57 | $this->assertSame('utf8', $config['charset']); |
||
58 | |||
59 | // doctrine.dbal.ibmdb2_connection |
||
60 | $config = $container->getDefinition('doctrine.dbal.ibmdb2_connection')->getArgument(0); |
||
61 | $this->assertSame('ibm_db2', $config['driver']); |
||
62 | $this->assertSame('ibmdb2_db', $config['dbname']); |
||
63 | $this->assertSame('ibmdb2_user', $config['user']); |
||
64 | $this->assertSame('ibmdb2_s3cr3t', $config['password']); |
||
65 | $this->assertSame('TCPIP', $config['protocol']); |
||
66 | |||
67 | // doctrine.dbal.pgsql_connection |
||
68 | $config = $container->getDefinition('doctrine.dbal.pgsql_connection')->getArgument(0); |
||
69 | $this->assertSame('pdo_pgsql', $config['driver']); |
||
70 | $this->assertSame('pgsql_schema', $config['dbname']); |
||
71 | $this->assertSame('pgsql_user', $config['user']); |
||
72 | $this->assertSame('pgsql_s3cr3t', $config['password']); |
||
73 | $this->assertSame('pgsql_db', $config['default_dbname']); |
||
74 | $this->assertSame('require', $config['sslmode']); |
||
75 | $this->assertSame('postgresql-ca.pem', $config['sslrootcert']); |
||
76 | $this->assertSame('postgresql-cert.pem', $config['sslcert']); |
||
77 | $this->assertSame('postgresql-key.pem', $config['sslkey']); |
||
78 | $this->assertSame('postgresql.crl', $config['sslcrl']); |
||
79 | $this->assertSame('utf8', $config['charset']); |
||
80 | |||
81 | // doctrine.dbal.sqlanywhere_connection |
||
82 | $config = $container->getDefinition('doctrine.dbal.sqlanywhere_connection')->getArgument(0); |
||
83 | $this->assertSame('sqlanywhere', $config['driver']); |
||
84 | $this->assertSame('localhost', $config['host']); |
||
85 | $this->assertSame(2683, $config['port']); |
||
86 | $this->assertSame('sqlanywhere_server', $config['server']); |
||
87 | $this->assertSame('sqlanywhere_db', $config['dbname']); |
||
88 | $this->assertSame('sqlanywhere_user', $config['user']); |
||
89 | $this->assertSame('sqlanywhere_s3cr3t', $config['password']); |
||
90 | $this->assertTrue($config['persistent']); |
||
91 | $this->assertSame('utf8', $config['charset']); |
||
92 | } |
||
93 | |||
94 | public function testDbalLoadFromXmlSingleConnections() |
||
95 | { |
||
96 | $container = $this->loadContainer('dbal_service_single_connection'); |
||
97 | |||
98 | // doctrine.dbal.mysql_connection |
||
99 | $config = $container->getDefinition('doctrine.dbal.default_connection')->getArgument(0); |
||
100 | |||
101 | $this->assertEquals('mysql_s3cr3t', $config['password']); |
||
102 | $this->assertEquals('mysql_user', $config['user']); |
||
103 | $this->assertEquals('mysql_db', $config['dbname']); |
||
104 | $this->assertEquals('/path/to/mysqld.sock', $config['unix_socket']); |
||
105 | $this->assertEquals('5.6.20', $config['serverVersion']); |
||
106 | } |
||
107 | |||
108 | public function testDbalLoadSingleMasterSlaveConnection() |
||
109 | { |
||
110 | $container = $this->loadContainer('dbal_service_single_master_slave_connection'); |
||
111 | |||
112 | // doctrine.dbal.mysql_connection |
||
113 | $param = $container->getDefinition('doctrine.dbal.default_connection')->getArgument(0); |
||
114 | |||
115 | $this->assertEquals('Doctrine\\DBAL\\Connections\\MasterSlaveConnection', $param['wrapperClass']); |
||
116 | $this->assertTrue($param['keepSlave']); |
||
117 | $this->assertEquals( |
||
118 | [ |
||
119 | 'user' => 'mysql_user', |
||
120 | 'password' => 'mysql_s3cr3t', |
||
121 | 'port' => null, |
||
122 | 'dbname' => 'mysql_db', |
||
123 | 'host' => 'localhost', |
||
124 | 'unix_socket' => '/path/to/mysqld.sock', |
||
125 | ], |
||
126 | $param['master'] |
||
127 | ); |
||
128 | $this->assertEquals( |
||
129 | [ |
||
130 | 'user' => 'slave_user', |
||
131 | 'password' => 'slave_s3cr3t', |
||
132 | 'port' => null, |
||
133 | 'dbname' => 'slave_db', |
||
134 | 'host' => 'localhost', |
||
135 | 'unix_socket' => '/path/to/mysqld_slave.sock', |
||
136 | ], |
||
137 | $param['slaves']['slave1'] |
||
138 | ); |
||
139 | $this->assertEquals(['engine' => 'InnoDB'], $param['defaultTableOptions']); |
||
140 | } |
||
141 | |||
142 | public function testDbalLoadPoolShardingConnection() |
||
143 | { |
||
144 | $container = $this->loadContainer('dbal_service_pool_sharding_connection'); |
||
145 | |||
146 | // doctrine.dbal.mysql_connection |
||
147 | $param = $container->getDefinition('doctrine.dbal.default_connection')->getArgument(0); |
||
148 | |||
149 | $this->assertEquals('Doctrine\\DBAL\\Sharding\\PoolingShardConnection', $param['wrapperClass']); |
||
150 | $this->assertEquals(new Reference('foo.shard_choser'), $param['shardChoser']); |
||
151 | $this->assertEquals( |
||
152 | [ |
||
153 | 'user' => 'mysql_user', |
||
154 | 'password' => 'mysql_s3cr3t', |
||
155 | 'port' => null, |
||
156 | 'dbname' => 'mysql_db', |
||
157 | 'host' => 'localhost', |
||
158 | 'unix_socket' => '/path/to/mysqld.sock', |
||
159 | ], |
||
160 | $param['global'] |
||
161 | ); |
||
162 | $this->assertEquals( |
||
163 | [ |
||
164 | 'user' => 'shard_user', |
||
165 | 'password' => 'shard_s3cr3t', |
||
166 | 'port' => null, |
||
167 | 'dbname' => 'shard_db', |
||
168 | 'host' => 'localhost', |
||
169 | 'unix_socket' => '/path/to/mysqld_shard.sock', |
||
170 | 'id' => 1, |
||
171 | ], |
||
172 | $param['shards'][0] |
||
173 | ); |
||
174 | $this->assertEquals(['engine' => 'InnoDB'], $param['defaultTableOptions']); |
||
175 | } |
||
176 | |||
177 | public function testDbalLoadSavepointsForNestedTransactions() |
||
178 | { |
||
179 | $container = $this->loadContainer('dbal_savepoints'); |
||
180 | |||
181 | $calls = $container->getDefinition('doctrine.dbal.savepoints_connection')->getMethodCalls(); |
||
182 | $this->assertCount(1, $calls); |
||
183 | $this->assertEquals('setNestTransactionsWithSavepoints', $calls[0][0]); |
||
184 | $this->assertTrue($calls[0][1][0]); |
||
185 | |||
186 | $calls = $container->getDefinition('doctrine.dbal.nosavepoints_connection')->getMethodCalls(); |
||
187 | $this->assertCount(0, $calls); |
||
188 | |||
189 | $calls = $container->getDefinition('doctrine.dbal.notset_connection')->getMethodCalls(); |
||
190 | $this->assertCount(0, $calls); |
||
191 | } |
||
192 | |||
193 | public function testLoadSimpleSingleConnection() |
||
194 | { |
||
195 | $container = $this->loadContainer('orm_service_simple_single_entity_manager'); |
||
196 | |||
197 | $definition = $container->getDefinition('doctrine.dbal.default_connection'); |
||
198 | |||
199 | $this->assertDICConstructorArguments($definition, [ |
||
200 | [ |
||
201 | 'dbname' => 'db', |
||
202 | 'host' => 'localhost', |
||
203 | 'port' => null, |
||
204 | 'user' => 'root', |
||
205 | 'password' => null, |
||
206 | 'driver' => 'pdo_mysql', |
||
207 | 'driverOptions' => [], |
||
208 | 'defaultTableOptions' => [], |
||
209 | ], |
||
210 | new Reference('doctrine.dbal.default_connection.configuration'), |
||
211 | new Reference('doctrine.dbal.default_connection.event_manager'), |
||
212 | [], |
||
213 | ]); |
||
214 | |||
215 | $definition = $container->getDefinition('doctrine.orm.default_entity_manager'); |
||
216 | $this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getClass()); |
||
217 | $this->assertEquals(['%doctrine.orm.entity_manager.class%', 'create'], $definition->getFactory()); |
||
218 | |||
219 | $this->assertDICConstructorArguments($definition, [ |
||
220 | new Reference('doctrine.dbal.default_connection'), |
||
221 | new Reference('doctrine.orm.default_configuration'), |
||
222 | ]); |
||
223 | } |
||
224 | |||
225 | /** |
||
226 | * The PDO driver doesn't require a database name to be to set when connecting to a database server |
||
227 | */ |
||
228 | public function testLoadSimpleSingleConnectionWithoutDbName() |
||
229 | { |
||
230 | $container = $this->loadContainer('orm_service_simple_single_entity_manager_without_dbname'); |
||
231 | |||
232 | /** @var Definition $definition */ |
||
233 | $definition = $container->getDefinition('doctrine.dbal.default_connection'); |
||
234 | |||
235 | $this->assertDICConstructorArguments($definition, [ |
||
236 | [ |
||
237 | 'host' => 'localhost', |
||
238 | 'port' => null, |
||
239 | 'user' => 'root', |
||
240 | 'password' => null, |
||
241 | 'driver' => 'pdo_mysql', |
||
242 | 'driverOptions' => [], |
||
243 | 'defaultTableOptions' => [], |
||
244 | ], |
||
245 | new Reference('doctrine.dbal.default_connection.configuration'), |
||
246 | new Reference('doctrine.dbal.default_connection.event_manager'), |
||
247 | [], |
||
248 | ]); |
||
249 | |||
250 | $definition = $container->getDefinition('doctrine.orm.default_entity_manager'); |
||
251 | $this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getClass()); |
||
252 | $factory = $definition->getFactory(); |
||
253 | |||
254 | $this->assertEquals('%doctrine.orm.entity_manager.class%', $factory[0]); |
||
255 | $this->assertEquals('create', $factory[1]); |
||
256 | |||
257 | $this->assertDICConstructorArguments($definition, [ |
||
258 | new Reference('doctrine.dbal.default_connection'), |
||
259 | new Reference('doctrine.orm.default_configuration'), |
||
260 | ]); |
||
261 | } |
||
262 | |||
263 | public function testLoadSingleConnection() |
||
264 | { |
||
265 | $container = $this->loadContainer('orm_service_single_entity_manager'); |
||
266 | |||
267 | $definition = $container->getDefinition('doctrine.dbal.default_connection'); |
||
268 | |||
269 | $this->assertDICConstructorArguments($definition, [ |
||
270 | [ |
||
271 | 'host' => 'localhost', |
||
272 | 'driver' => 'pdo_sqlite', |
||
273 | 'driverOptions' => [], |
||
274 | 'user' => 'sqlite_user', |
||
275 | 'port' => null, |
||
276 | 'password' => 'sqlite_s3cr3t', |
||
277 | 'dbname' => 'sqlite_db', |
||
278 | 'memory' => true, |
||
279 | 'defaultTableOptions' => [], |
||
280 | ], |
||
281 | new Reference('doctrine.dbal.default_connection.configuration'), |
||
282 | new Reference('doctrine.dbal.default_connection.event_manager'), |
||
283 | [], |
||
284 | ]); |
||
285 | |||
286 | $definition = $container->getDefinition('doctrine.orm.default_entity_manager'); |
||
287 | $this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getClass()); |
||
288 | $this->assertEquals(['%doctrine.orm.entity_manager.class%', 'create'], $definition->getFactory()); |
||
289 | |||
290 | $this->assertDICConstructorArguments($definition, [ |
||
291 | new Reference('doctrine.dbal.default_connection'), |
||
292 | new Reference('doctrine.orm.default_configuration'), |
||
293 | ]); |
||
294 | |||
295 | $configDef = $container->getDefinition('doctrine.orm.default_configuration'); |
||
296 | $this->assertDICDefinitionMethodCallOnce($configDef, 'setDefaultRepositoryClassName', ['Acme\Doctrine\Repository']); |
||
297 | } |
||
298 | |||
299 | public function testLoadMultipleConnections() |
||
300 | { |
||
301 | $container = $this->loadContainer('orm_service_multiple_entity_managers'); |
||
302 | |||
303 | $definition = $container->getDefinition('doctrine.dbal.conn1_connection'); |
||
304 | |||
305 | $args = $definition->getArguments(); |
||
306 | $this->assertEquals('pdo_sqlite', $args[0]['driver']); |
||
307 | $this->assertEquals('localhost', $args[0]['host']); |
||
308 | $this->assertEquals('sqlite_user', $args[0]['user']); |
||
309 | $this->assertEquals('doctrine.dbal.conn1_connection.configuration', (string) $args[1]); |
||
310 | $this->assertEquals('doctrine.dbal.conn1_connection.event_manager', (string) $args[2]); |
||
311 | |||
312 | $this->assertEquals('doctrine.orm.em2_entity_manager', (string) $container->getAlias('doctrine.orm.entity_manager')); |
||
313 | |||
314 | $definition = $container->getDefinition('doctrine.orm.em1_entity_manager'); |
||
315 | $this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getClass()); |
||
316 | $this->assertEquals(['%doctrine.orm.entity_manager.class%', 'create'], $definition->getFactory()); |
||
317 | |||
318 | $arguments = $definition->getArguments(); |
||
319 | $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[0]); |
||
320 | $this->assertEquals('doctrine.dbal.conn1_connection', (string) $arguments[0]); |
||
321 | $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[1]); |
||
322 | $this->assertEquals('doctrine.orm.em1_configuration', (string) $arguments[1]); |
||
323 | |||
324 | $definition = $container->getDefinition('doctrine.dbal.conn2_connection'); |
||
325 | |||
326 | $args = $definition->getArguments(); |
||
327 | $this->assertEquals('pdo_sqlite', $args[0]['driver']); |
||
328 | $this->assertEquals('localhost', $args[0]['host']); |
||
329 | $this->assertEquals('sqlite_user', $args[0]['user']); |
||
330 | $this->assertEquals('doctrine.dbal.conn2_connection.configuration', (string) $args[1]); |
||
331 | $this->assertEquals('doctrine.dbal.conn2_connection.event_manager', (string) $args[2]); |
||
332 | |||
333 | $definition = $container->getDefinition('doctrine.orm.em2_entity_manager'); |
||
334 | $this->assertEquals('%doctrine.orm.entity_manager.class%', $definition->getClass()); |
||
335 | $this->assertEquals(['%doctrine.orm.entity_manager.class%', 'create'], $definition->getFactory()); |
||
336 | |||
337 | $arguments = $definition->getArguments(); |
||
338 | $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[0]); |
||
339 | $this->assertEquals('doctrine.dbal.conn2_connection', (string) $arguments[0]); |
||
340 | $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[1]); |
||
341 | $this->assertEquals('doctrine.orm.em2_configuration', (string) $arguments[1]); |
||
342 | |||
343 | $definition = $container->getDefinition((string) $container->getAlias('doctrine.orm.em1_metadata_cache')); |
||
344 | $this->assertEquals(DoctrineProvider::class, $definition->getClass()); |
||
345 | |||
346 | $definition = $container->getDefinition((string) $container->getAlias('doctrine.orm.em1_query_cache')); |
||
347 | $this->assertEquals(DoctrineProvider::class, $definition->getClass()); |
||
348 | $arguments = $definition->getArguments(); |
||
349 | $this->assertInstanceOf(Reference::class, $arguments[0]); |
||
350 | $this->assertEquals('cache.app', (string) $arguments[0]); |
||
351 | |||
352 | $definition = $container->getDefinition((string) $container->getAlias('doctrine.orm.em1_result_cache')); |
||
353 | $this->assertEquals(DoctrineProvider::class, $definition->getClass()); |
||
354 | $arguments = $definition->getArguments(); |
||
355 | $this->assertInstanceOf(Reference::class, $arguments[0]); |
||
356 | $this->assertEquals('cache.app', (string) $arguments[0]); |
||
357 | } |
||
358 | |||
359 | public function testLoadLogging() |
||
360 | { |
||
361 | $container = $this->loadContainer('dbal_logging'); |
||
362 | |||
363 | $definition = $container->getDefinition('doctrine.dbal.log_connection.configuration'); |
||
364 | $this->assertDICDefinitionMethodCallOnce($definition, 'setSQLLogger', [new Reference('doctrine.dbal.logger')]); |
||
365 | |||
366 | $definition = $container->getDefinition('doctrine.dbal.profile_connection.configuration'); |
||
367 | $this->assertDICDefinitionMethodCallOnce($definition, 'setSQLLogger', [new Reference('doctrine.dbal.logger.profiling.profile')]); |
||
368 | |||
369 | $definition = $container->getDefinition('doctrine.dbal.profile_with_backtrace_connection.configuration'); |
||
370 | $this->assertDICDefinitionMethodCallOnce($definition, 'setSQLLogger', [new Reference('doctrine.dbal.logger.backtrace.profile_with_backtrace')]); |
||
371 | |||
372 | $definition = $container->getDefinition('doctrine.dbal.backtrace_without_profile_connection.configuration'); |
||
373 | $this->assertDICDefinitionNoMethodCall($definition, 'setSQLLogger'); |
||
374 | |||
375 | $definition = $container->getDefinition('doctrine.dbal.both_connection.configuration'); |
||
376 | $this->assertDICDefinitionMethodCallOnce($definition, 'setSQLLogger', [new Reference('doctrine.dbal.logger.chain.both')]); |
||
377 | } |
||
378 | |||
379 | public function testEntityManagerMetadataCacheDriverConfiguration() |
||
380 | { |
||
381 | $container = $this->loadContainer('orm_service_multiple_entity_managers'); |
||
382 | |||
383 | $definition = $container->getDefinition((string) $container->getAlias('doctrine.orm.em1_metadata_cache')); |
||
384 | $this->assertDICDefinitionClass($definition, DoctrineProvider::class); |
||
385 | |||
386 | $definition = $container->getDefinition((string) $container->getAlias('doctrine.orm.em2_metadata_cache')); |
||
387 | $this->assertDICDefinitionClass($definition, DoctrineProvider::class); |
||
388 | } |
||
389 | |||
390 | /** |
||
391 | * @group legacy |
||
392 | */ |
||
393 | View Code Duplication | public function testEntityManagerMemcacheMetadataCacheDriverConfiguration() |
|
394 | { |
||
395 | $container = $this->loadContainer('orm_service_simple_single_entity_manager_memcache'); |
||
396 | |||
397 | $definition = $container->getDefinition((string) $container->getAlias('doctrine.orm.default_metadata_cache')); |
||
398 | $this->assertDICDefinitionClass($definition, '%doctrine_cache.memcache.class%'); |
||
399 | $this->assertDICDefinitionMethodCallOnce( |
||
400 | $definition, |
||
401 | 'setMemcache', |
||
402 | [new Reference('doctrine_cache.services.doctrine.orm.default_metadata_cache.connection')] |
||
403 | ); |
||
404 | |||
405 | $definition = $container->getDefinition('doctrine_cache.services.doctrine.orm.default_metadata_cache.connection'); |
||
406 | $this->assertDICDefinitionClass($definition, '%doctrine_cache.memcache.connection.class%'); |
||
407 | $this->assertDICDefinitionMethodCallOnce($definition, 'addServer', [ |
||
408 | 'localhost', |
||
409 | '11211', |
||
410 | ]); |
||
411 | } |
||
412 | |||
413 | /** |
||
414 | * @group legacy |
||
415 | */ |
||
416 | View Code Duplication | public function testEntityManagerRedisMetadataCacheDriverConfigurationWithDatabaseKey() |
|
433 | |||
434 | public function testDependencyInjectionImportsOverrideDefaults() |
||
444 | |||
445 | public function testSingleEntityManagerMultipleMappingBundleDefinitions() |
||
482 | |||
483 | public function testMultipleEntityManagersMappingBundleDefinitions() |
||
524 | |||
525 | public function testSingleEntityManagerDefaultTableOptions() |
||
543 | |||
544 | public function testSetTypes() |
||
554 | |||
555 | public function testSetCustomFunctions() |
||
564 | |||
565 | View Code Duplication | public function testSetNamingStrategy() |
|
566 | { |
||
567 | $container = $this->loadContainer('orm_namingstrategy'); |
||
568 | |||
569 | $def1 = $container->getDefinition('doctrine.orm.em1_configuration'); |
||
570 | $def2 = $container->getDefinition('doctrine.orm.em2_configuration'); |
||
571 | |||
572 | $this->assertDICDefinitionMethodCallOnce($def1, 'setNamingStrategy', [0 => new Reference('doctrine.orm.naming_strategy.default')]); |
||
573 | $this->assertDICDefinitionMethodCallOnce($def2, 'setNamingStrategy', [0 => new Reference('doctrine.orm.naming_strategy.underscore')]); |
||
574 | } |
||
575 | |||
576 | View Code Duplication | public function testSetQuoteStrategy() |
|
577 | { |
||
578 | $container = $this->loadContainer('orm_quotestrategy'); |
||
586 | |||
587 | public function testSecondLevelCache() |
||
644 | |||
645 | public function testSingleEMSetCustomFunctions() |
||
652 | |||
653 | public function testAddCustomHydrationMode() |
||
660 | |||
661 | public function testAddFilter() |
||
680 | |||
681 | public function testResolveTargetEntity() |
||
690 | |||
691 | public function testAttachEntityListeners() |
||
761 | |||
762 | public function testDbalAutoCommit() |
||
769 | |||
770 | public function testDbalOracleConnectstring() |
||
777 | |||
778 | public function testDbalOracleInstancename() |
||
785 | |||
786 | public function testDbalSchemaFilter() |
||
797 | |||
798 | public function testDbalSchemaFilterNewConfig() |
||
843 | |||
844 | public function testEntityListenerResolver() |
||
860 | |||
861 | public function testAttachEntityListenerTag() |
||
892 | |||
893 | public function testAttachEntityListenersTwoConnections() |
||
912 | |||
913 | public function testAttachLazyEntityListener() |
||
939 | |||
940 | public function testAttachLazyEntityListenerForCustomResolver() |
||
957 | |||
958 | /** |
||
959 | * @expectedException \InvalidArgumentException |
||
960 | * @expectedExceptionMessage EntityListenerServiceResolver |
||
961 | */ |
||
962 | View Code Duplication | public function testLazyEntityListenerResolverWithoutCorrectInterface() |
|
973 | |||
974 | public function testPrivateLazyEntityListener() |
||
987 | |||
988 | /** |
||
989 | * @expectedException \InvalidArgumentException |
||
990 | * @expectedExceptionMessageRegExp /The service ".*" must not be abstract as this entity listener is lazy-loaded/ |
||
991 | */ |
||
992 | View Code Duplication | public function testAbstractLazyEntityListener() |
|
1003 | |||
1004 | public function testRepositoryFactory() |
||
1011 | |||
1012 | private function loadContainer($fixture, array $bundles = ['YamlBundle'], CompilerPassInterface $compilerPass = null) |
||
1027 | |||
1028 | private function getContainer(array $bundles) |
||
1055 | |||
1056 | /** |
||
1057 | * Assertion on the Class of a DIC Service Definition. |
||
1058 | * |
||
1059 | * @param string $expectedClass |
||
1060 | */ |
||
1061 | private function assertDICDefinitionClass(Definition $definition, $expectedClass) |
||
1065 | |||
1066 | private function assertDICConstructorArguments(Definition $definition, $args) |
||
1070 | |||
1071 | View Code Duplication | private function assertDICDefinitionMethodCallAt($pos, Definition $definition, $methodName, array $params = null) |
|
1088 | |||
1089 | /** |
||
1090 | * Assertion for the DI Container, check if the given definition contains a method call with the given parameters. |
||
1091 | * |
||
1092 | * @param string $methodName |
||
1093 | * @param array $params |
||
1094 | */ |
||
1095 | View Code Duplication | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
1119 | |||
1120 | private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = [], $nbCalls = 1) |
||
1141 | |||
1142 | /** |
||
1143 | * Assertion for the DI Container, check if the given definition does not contain a method call with the given parameters. |
||
1144 | * |
||
1145 | * @param string $methodName |
||
1146 | * @param array $params |
||
1147 | */ |
||
1148 | private function assertDICDefinitionNoMethodCall(Definition $definition, $methodName, array $params = null) |
||
1163 | |||
1164 | private function compileContainer(ContainerBuilder $container) |
||
1170 | } |
||
1171 | |||
1191 |
For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a
@return
doc comment to communicate to implementors of these methods what they are expected to return.