Use namespaced version of IDatabase
[lhc/web/wiklou.git] / tests / phpunit / includes / libs / rdbms / connectionmanager / SessionConsistentConnectionManagerTest.php
index 4dcab82..3982ee7 100644 (file)
@@ -2,8 +2,8 @@
 
 namespace Wikimedia\Tests\Rdbms;
 
-use IDatabase;
-use LoadBalancer;
+use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\Rdbms\LoadBalancer;
 use PHPUnit_Framework_MockObject_MockObject;
 use Wikimedia\Rdbms\SessionConsistentConnectionManager;
 
@@ -19,7 +19,8 @@ class SessionConsistentConnectionManagerTest extends \PHPUnit_Framework_TestCase
         * @return IDatabase|PHPUnit_Framework_MockObject_MockObject
         */
        private function getIDatabaseMock() {
-               return $this->getMock( IDatabase::class );
+               return $this->getMockBuilder( IDatabase::class )
+                       ->getMock();
        }
 
        /**
@@ -105,60 +106,4 @@ class SessionConsistentConnectionManagerTest extends \PHPUnit_Framework_TestCase
                $manager = new SessionConsistentConnectionManager( $lb );
                $manager->releaseConnection( $database );
        }
-
-       public function testBeginAtomicSection() {
-               $database = $this->getIDatabaseMock();
-               $lb = $this->getLoadBalancerMock();
-
-               $lb->expects( $this->exactly( 2 ) )
-                       ->method( 'getConnection' )
-                       ->with( DB_MASTER )
-                       ->will( $this->returnValue( $database ) );
-
-               $database->expects( $this->once() )
-                       ->method( 'startAtomic' )
-                       ->will( $this->returnValue( null ) );
-
-               $manager = new SessionConsistentConnectionManager( $lb );
-               $manager->beginAtomicSection( 'TEST' );
-
-               // Should also ask for a DB_MASTER connection.
-               // This is asserted by the $lb mock.
-               $manager->getReadConnection();
-       }
-
-       public function testCommitAtomicSection() {
-               $database = $this->getIDatabaseMock();
-               $lb = $this->getLoadBalancerMock();
-
-               $lb->expects( $this->once() )
-                       ->method( 'reuseConnection' )
-                       ->with( $database )
-                       ->will( $this->returnValue( null ) );
-
-               $database->expects( $this->once() )
-                       ->method( 'endAtomic' )
-                       ->will( $this->returnValue( null ) );
-
-               $manager = new SessionConsistentConnectionManager( $lb );
-               $manager->commitAtomicSection( $database, 'TEST' );
-       }
-
-       public function testRollbackAtomicSection() {
-               $database = $this->getIDatabaseMock();
-               $lb = $this->getLoadBalancerMock();
-
-               $lb->expects( $this->once() )
-                       ->method( 'reuseConnection' )
-                       ->with( $database )
-                       ->will( $this->returnValue( null ) );
-
-               $database->expects( $this->once() )
-                       ->method( 'rollback' )
-                       ->will( $this->returnValue( null ) );
-
-               $manager = new SessionConsistentConnectionManager( $lb );
-               $manager->rollbackAtomicSection( $database, 'TEST' );
-       }
-
 }