15 use MediaWikiCoversValidator;
16 use PHPUnit4And6Compat;
22 $lb = $this->getMock( ILoadBalancer::class );
24 $lb->method(
'getConnection' )->willReturnCallback(
30 $lb->method(
'getConnectionRef' )->willReturnCallback(
31 function ()
use ( $lb ) {
43 $db = $this->getMockBuilder( Database::class )
44 ->disableOriginalConstructor()
48 $db->method(
'__toString' )->willReturn(
'MOCK_DB' );
65 $this->assertInstanceOf( ResultWrapper::class, $ref->select(
'whatever',
'*' ) );
69 $lb = $this->getMock( ILoadBalancer::class );
71 $lb->expects( $this->once() )
72 ->method(
'getConnection' )
73 ->with(
DB_MASTER, [
'test' ],
'dummy', ILoadBalancer::CONN_TRX_AUTOCOMMIT )
82 [
DB_MASTER, [
'test' ],
'dummy', ILoadBalancer::CONN_TRX_AUTOCOMMIT ]
85 $this->assertInstanceOf( ResultWrapper::class, $ref->select(
'whatever',
'*' ) );
91 $lb->expects( $this->once() )
92 ->method(
'reuseConnection' );
100 $this->assertInstanceOf( ResultWrapper::class, $ref->select(
'whatever',
'*' ) );
104 $this->setExpectedException( InvalidArgumentException::class,
'' );
114 $lb = $this->getMock( ILoadBalancer::class );
117 $lb->expects( $this->never() )
118 ->method(
'getConnection' );
122 $this->assertSame(
'dummy', $ref->getDomainID() );
128 $this->assertInstanceOf( ResultWrapper::class, $ref->select(
'whatever',
'*' ) );
133 $this->assertInternalType(
'string', $ref->__toString() );
137 $this->assertInternalType(
'string', $ref->__toString() );
Wikimedia\Rdbms\DBConnRef.
getDBConnRef(ILoadBalancer $lb=null)
testGetDomainID()
Wikimedia\Rdbms\DBConnRef::getDomainId.
innerMethodForTestDestruct(ILoadBalancer $lb)
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use