| Conditions | 2 |
| Paths | 2 |
| Total Lines | 56 |
| Code Lines | 40 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 33 | $this->compile(); |
||
| 34 | |||
| 35 | $this->assertContainerBuilderHasServiceDefinitionWithArgument('tactician.middleware.doctrine.default', 0, new Reference('doctrine.orm.default_entity_manager')); |
||
| 36 | $this->assertContainerBuilderHasServiceDefinitionWithArgument('tactician.middleware.doctrine.second', 0, new Reference('doctrine.orm.second_entity_manager')); |
||
| 37 | $this->assertContainerBuilderHasAlias('tactician.middleware.doctrine', 'tactician.middleware.doctrine.default'); |
||
| 38 | } |
||
| 39 | |||
| 40 | public function test_do_not_process_when_there_are_no_entity_managers() |
||
| 41 | { |
||
| 42 | if (!class_exists(TransactionMiddleware::class)) { |
||
| 43 | $this->markTestSkipped('"league/tactician-doctrine" is not installed'); |
||
| 44 | } |
||
| 45 | |||
| 46 | $this->compile(); |
||
| 47 | |||
| 48 | $this->assertEmpty($this->container->getDefinitions()); |
||
| 49 | $this->assertEmpty($this->container->getAliases()); |
||
| 50 | } |
||
| 51 | |||
| 52 | public function test_do_not_process_when_tactician_doctrine_is_not_installed() |
||
| 53 | { |
||
| 54 | if (class_exists(TransactionMiddleware::class)) { |
||
| 55 | $this->markTestSkipped('"league/tactician-doctrine" is installed'); |
||
| 56 | } |
||
| 57 | |||
| 58 | $this->setParameter('doctrine.entity_managers', ['default' => 'doctrine.orm.default_entity_manager']); |
||
| 59 | $this->setParameter('doctrine.default_entity_manager', 'default'); |
||
| 60 | |||
| 61 | $this->compile(); |
||
| 62 | |||
| 63 | $this->assertEmpty($this->container->getDefinitions()); |
||
| 64 | $this->assertEmpty($this->container->getAliases()); |
||
| 65 | } |
||
| 66 | } |
||
| 67 |