+
+ /**
+ * @covers \Wikimedia\Rdbms\LoadBalancer::getLazyConnectionRef
+ */
+ public function testGetLazyConnectionRef() {
+ $lb = $this->newMultiServerLocalLoadBalancer();
+
+ $rMaster = $lb->getLazyConnectionRef( DB_MASTER );
+ $rReplica = $lb->getLazyConnectionRef( 1 );
+ $this->assertFalse( $lb->getAnyOpenConnection( 0 ) );
+ $this->assertFalse( $lb->getAnyOpenConnection( 1 ) );
+
+ $rMaster->getType();
+ $rReplica->getType();
+ $rMaster->getDomainID();
+ $rReplica->getDomainID();
+ $this->assertFalse( $lb->getAnyOpenConnection( 0 ) );
+ $this->assertFalse( $lb->getAnyOpenConnection( 1 ) );
+
+ $rMaster->query( "SELECT 1", __METHOD__ );
+ $this->assertNotFalse( $lb->getAnyOpenConnection( 0 ) );
+
+ $rReplica->query( "SELECT 1", __METHOD__ );
+ $this->assertNotFalse( $lb->getAnyOpenConnection( 0 ) );
+ $this->assertNotFalse( $lb->getAnyOpenConnection( 1 ) );
+ }