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 ) {
44 ->disableOriginalConstructor()
48 $db->method(
'select' )->willReturnCallback(
function () use ( &$open ) {
50 throw new LogicException(
"Not open" );
55 $db->method(
'close' )->willReturnCallback(
function ()
use ( &$open ) {
60 $db->method(
'isOpen' )->willReturnCallback(
function ()
use ( &$open ) {
63 $db->method(
'open' )->willReturnCallback(
function ()
use ( &$open ) {
68 $db->method(
'__toString' )->willReturn(
'MOCK_DB' );
85 $this->
assertInstanceOf( ResultWrapper::class, $ref->select(
'whatever',
'*' ) );
89 $lb = $this->
getMock( ILoadBalancer::class );
91 $lb->expects( $this->
once() )
92 ->method(
'getConnection' )
93 ->with(
DB_MASTER, [
'test' ],
'dummy', ILoadBalancer::CONN_TRX_AUTOCOMMIT )
102 [
DB_MASTER, [
'test' ],
'dummy', ILoadBalancer::CONN_TRX_AUTOCOMMIT ],
106 $this->
assertInstanceOf( ResultWrapper::class, $ref->select(
'whatever',
'*' ) );
111 [
DB_MASTER, [
'test' ],
'dummy', ILoadBalancer::CONN_TRX_AUTOCOMMIT ],
120 $lb->expects( $this->
once() )
121 ->method(
'reuseConnection' );
129 $this->
assertInstanceOf( ResultWrapper::class, $ref->select(
'whatever',
'*' ) );
143 $lb = $this->
getMock( ILoadBalancer::class );
146 $lb->expects( $this->never() )
147 ->method(
'getConnection' );
151 $this->
assertSame(
'dummy', $ref->getDomainID() );
160 $this->
assertInstanceOf( ResultWrapper::class, $ref->select(
'whatever',
'*' ) );
208 $ref->$method( ...
$args );
213 [
'insert', [
'table', [
'a' => 1 ] ] ],
214 [
'update', [
'table', [
'a' => 1 ], [
'a' => 2 ] ] ],
215 [
'delete', [
'table', [
'a' => 1 ] ] ],
216 [
'replace', [
'table', [
'a' ], [
'a' => 1 ] ] ],
217 [
'upsert', [
'table', [
'a' => 1 ], [
'a' ], [
'a = a + 1' ] ] ],
218 [
'lock', [
'k',
'method' ] ],
219 [
'unlock', [
'k',
'method' ] ],
220 [
'getScopedLockAndFlush', [
'k',
'method', 1 ] ]
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Wikimedia\Rdbms\DBConnRef.
testClose()
Wikimedia\Rdbms\DBConnRef::close \Wikimedia\Rdbms\DBUnexpectedError.
getDBConnRef(ILoadBalancer $lb=null)
testSelect()
Wikimedia\Rdbms\DBConnRef::select.
testRoleExceptions( $method, $args)
Wikimedia\Rdbms\DBConnRef::getReferenceRole Wikimedia\Rdbms\DBReadOnlyRoleError provideRoleExceptions...
testGetDomainID()
Wikimedia\Rdbms\DBConnRef::getDomainId.
testGetReferenceRole()
Wikimedia\Rdbms\DBConnRef::getReferenceRole.
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