7 use PHPUnit_Framework_MockObject_MockObject;
31 ->disableOriginalConstructor()
41 $lb->expects( $this->once() )
42 ->method(
'getConnection' )
43 ->with(
DB_REPLICA, [
'group1' ],
'someDbName' )
44 ->will( $this->returnValue( $database ) );
47 $actual = $manager->getReadConnection();
49 $this->assertSame( $database, $actual );
56 $lb->expects( $this->once() )
57 ->method(
'getConnection' )
58 ->with(
DB_REPLICA, [
'group2' ],
'someDbName' )
59 ->will( $this->returnValue( $database ) );
62 $actual = $manager->getReadConnection( [
'group2' ] );
64 $this->assertSame( $database, $actual );
71 $lb->expects( $this->once() )
72 ->method(
'getConnection' )
73 ->with(
DB_MASTER, [
'group1' ],
'someDbName' )
74 ->will( $this->returnValue( $database ) );
77 $actual = $manager->getWriteConnection();
79 $this->assertSame( $database, $actual );
86 $lb->expects( $this->once() )
87 ->method(
'reuseConnection' )
89 ->will( $this->returnValue(
null ) );
92 $manager->releaseConnection( $database );
99 $lb->expects( $this->once() )
100 ->method(
'getConnectionRef' )
101 ->with(
DB_REPLICA, [
'group1' ],
'someDbName' )
102 ->will( $this->returnValue( $database ) );
105 $actual = $manager->getReadConnectionRef();
107 $this->assertSame( $database, $actual );
114 $lb->expects( $this->once() )
115 ->method(
'getConnectionRef' )
116 ->with(
DB_REPLICA, [
'group2' ],
'someDbName' )
117 ->will( $this->returnValue( $database ) );
120 $actual = $manager->getReadConnectionRef( [
'group2' ] );
122 $this->assertSame( $database, $actual );
129 $lb->expects( $this->once() )
130 ->method(
'getConnectionRef' )
131 ->with(
DB_MASTER, [
'group1' ],
'someDbName' )
132 ->will( $this->returnValue( $database ) );
135 $actual = $manager->getWriteConnectionRef();
137 $this->assertSame( $database, $actual );