|
@@ 33-45 (lines=13) @@
|
| 30 |
|
$this->assertEquals('default', $registry->getDefaultManagerName()); |
| 31 |
|
} |
| 32 |
|
|
| 33 |
|
public function testGetDefaultConnection() : void |
| 34 |
|
{ |
| 35 |
|
$conn = $this->getMockBuilder('Doctrine\DBAL\Connection')->disableOriginalConstructor()->getMock(); |
| 36 |
|
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock(); |
| 37 |
|
$container->expects($this->once()) |
| 38 |
|
->method('get') |
| 39 |
|
->with($this->equalTo('doctrine.dbal.default_connection')) |
| 40 |
|
->will($this->returnValue($conn)); |
| 41 |
|
|
| 42 |
|
$registry = new Registry($container, ['default' => 'doctrine.dbal.default_connection'], [], 'default', 'default'); |
| 43 |
|
|
| 44 |
|
$this->assertSame($conn, $registry->getConnection()); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
public function testGetConnection() : void |
| 48 |
|
{ |
|
@@ 47-59 (lines=13) @@
|
| 44 |
|
$this->assertSame($conn, $registry->getConnection()); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
public function testGetConnection() : void |
| 48 |
|
{ |
| 49 |
|
$conn = $this->getMockBuilder('Doctrine\DBAL\Connection')->disableOriginalConstructor()->getMock(); |
| 50 |
|
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock(); |
| 51 |
|
$container->expects($this->once()) |
| 52 |
|
->method('get') |
| 53 |
|
->with($this->equalTo('doctrine.dbal.default_connection')) |
| 54 |
|
->will($this->returnValue($conn)); |
| 55 |
|
|
| 56 |
|
$registry = new Registry($container, ['default' => 'doctrine.dbal.default_connection'], [], 'default', 'default'); |
| 57 |
|
|
| 58 |
|
$this->assertSame($conn, $registry->getConnection('default')); |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
/** |
| 62 |
|
* @expectedException \InvalidArgumentException |