Merge "tests: Prefer PHPUnit's assertSame() when comparing empty strings"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 20 Sep 2019 15:55:08 +0000 (15:55 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 20 Sep 2019 15:55:08 +0000 (15:55 +0000)
1  2 
tests/phpunit/includes/db/LBFactoryTest.php

@@@ -187,7 -187,7 +187,7 @@@ class LBFactoryTest extends MediaWikiTe
                };
  
                $factory = $this->newLBFactoryMultiLBs();
 -              $this->assertEquals( 0, $countLBsFunc( $factory ) );
 +              $this->assertSame( 0, $countLBsFunc( $factory ) );
                $dbw = $factory->getMainLB()->getConnection( DB_MASTER );
                $this->assertEquals( 1, $countLBsFunc( $factory ) );
                // Test that LoadBalancer instances made during pre-commit callbacks in do not
  
                $called = 0;
                $factory = $this->newLBFactoryMultiLBs();
 -              $this->assertEquals( 0, $countLBsFunc( $factory ) );
 +              $this->assertSame( 0, $countLBsFunc( $factory ) );
                $dbw = $factory->getMainLB()->getConnection( DB_MASTER );
                $this->assertEquals( 1, $countLBsFunc( $factory ) );
                // Test that LoadBalancer instances made during pre-commit callbacks in do not
                /** @var IMaintainableDatabase $db */
                $db = $lb->getConnection( DB_MASTER, [], '' );
  
-               $this->assertEquals(
+               $this->assertSame(
                        '',
                        $db->getDomainId(),
                        'Null domain ID handle used'
                );
-               $this->assertEquals(
-                       '',
+               $this->assertNull(
                        $db->getDBname(),
                        'Null domain ID handle used'
                );
-               $this->assertEquals(
+               $this->assertSame(
                        '',
                        $db->tablePrefix(),
                        'Main domain ID handle used; prefix is empty though'
                /** @var IMaintainableDatabase $db */
                $db = $lb->getConnection( DB_MASTER, [], '' );
  
-               $this->assertEquals( '', $db->getDomainID(), "Null domain used" );
+               $this->assertSame( '', $db->getDomainID(), "Null domain used" );
  
                $this->assertEquals(
                        $this->quoteTable( $db, 'page' ),
                $lb->forEachOpenConnection( function () use ( &$n ) {
                        ++$n;
                } );
 -              $this->assertEquals( 0, $n, "Connections closed" );
 +              $this->assertSame( 0, $n, "Connections closed" );
  
                $conn2 = $lb->getConnectionRef( DB_MASTER );
                $this->assertEquals(