| Total Complexity | 2 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 8 | class ApropriateConnectionTraitUnitTest extends ConnectionTraitTests |
||
| 9 | { |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Testing method getApropriateConnection |
||
| 13 | */ |
||
| 14 | public function testGetApropriateConnectionMultiple(): void |
||
| 15 | { |
||
| 16 | // setup |
||
| 17 | Conf::deleteConfigValue('default-db-connection/dsn'); |
||
| 18 | $this->setConnection('exact-db-connection'); |
||
| 19 | $mock = $this->getMock(); |
||
| 20 | $mock->setConnection(false); |
||
| 21 | $mock->expects($this->once()) |
||
| 22 | ->method('constructConnection') |
||
| 23 | ->willReturn(new PdoCrudMock()); |
||
| 24 | |||
| 25 | // test body |
||
| 26 | $connection = $mock->getApropriateConnection('exact-db-connection'); |
||
| 27 | |||
| 28 | // assertions |
||
| 29 | $this->assertInstanceOf(PdoCrudMock::class, $connection); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Testing method getApropriateConnection without overriding of the method getApropriateConnection |
||
| 34 | */ |
||
| 35 | public function testGetApropriateConnectionBase(): void |
||
| 50 | } |
||
| 51 | } |
||
| 52 |