diff options
author | Amir Sarabadani <ladsgroup@gmail.com> | 2023-07-31 21:29:07 +0200 |
---|---|---|
committer | Krinkle <krinkle@fastmail.com> | 2023-08-01 10:40:52 +0000 |
commit | 71a44aca13096c6aac230b19a771b4b81a76c414 (patch) | |
tree | 38748540a6eb0ceb04527ca5ccea12a070a7bd37 /tests/phpunit/includes/db/LBFactoryTest.php | |
parent | b57b81066e1f9b67a3f3a451655e95f6948d6333 (diff) | |
download | mediawikicore-71a44aca13096c6aac230b19a771b4b81a76c414.tar.gz mediawikicore-71a44aca13096c6aac230b19a771b4b81a76c414.zip |
rdbms: Move two static methods of LBFactory to ChronologyProtector
This clearly has nothing to do with LBF but is more related to CP. It's
not used outside of core anywhere, all usages fixed.
Bug: T326274
Change-Id: I6d07337fc2a9144c960073100d6078001283ace3
Diffstat (limited to 'tests/phpunit/includes/db/LBFactoryTest.php')
-rw-r--r-- | tests/phpunit/includes/db/LBFactoryTest.php | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/tests/phpunit/includes/db/LBFactoryTest.php b/tests/phpunit/includes/db/LBFactoryTest.php index 19b4d2b94237..4f013e6b8ac9 100644 --- a/tests/phpunit/includes/db/LBFactoryTest.php +++ b/tests/phpunit/includes/db/LBFactoryTest.php @@ -28,7 +28,6 @@ use Wikimedia\Rdbms\DatabaseDomain; use Wikimedia\Rdbms\IDatabase; use Wikimedia\Rdbms\IMaintainableDatabase; use Wikimedia\Rdbms\IReadableDatabase; -use Wikimedia\Rdbms\LBFactory; use Wikimedia\Rdbms\LBFactoryMulti; use Wikimedia\Rdbms\LBFactorySimple; use Wikimedia\Rdbms\LoadBalancer; @@ -654,71 +653,6 @@ class LBFactoryTest extends MediaWikiIntegrationTestCase { } } - public function testCPPosIndexCookieValues() { - $time = 1526522031; - $agentId = md5( 'Ramsey\'s Loyal Presa Canario' ); - - $this->assertEquals( - '3@542#c47dcfb0566e7d7bc110a6128a45c93a', - LBFactory::makeCookieValueFromCPIndex( 3, 542, $agentId ) - ); - - $lbFactory = $this->newLBFactoryMulti(); - $lbFactory->setRequestInfo( [ 'IPAddress' => '10.64.24.52', 'UserAgent' => 'meow' ] ); - $this->assertEquals( - '1@542#c47dcfb0566e7d7bc110a6128a45c93a', - LBFactory::makeCookieValueFromCPIndex( 1, 542, $agentId ) - ); - - $this->assertSame( - null, - LBFactory::getCPInfoFromCookieValue( "5#$agentId", $time - 10 )['index'], - 'No time set' - ); - $this->assertSame( - null, - LBFactory::getCPInfoFromCookieValue( "5@$time", $time - 10 )['index'], - 'No agent set' - ); - $this->assertSame( - null, - LBFactory::getCPInfoFromCookieValue( "0@$time#$agentId", $time - 10 )['index'], - 'Bad index' - ); - - $this->assertSame( - 2, - LBFactory::getCPInfoFromCookieValue( "2@$time#$agentId", $time - 10 )['index'], - 'Fresh' - ); - $this->assertSame( - 2, - LBFactory::getCPInfoFromCookieValue( "2@$time#$agentId", $time + 9 - 10 )['index'], - 'Almost stale' - ); - $this->assertSame( - null, - LBFactory::getCPInfoFromCookieValue( "0@$time#$agentId", $time + 9 - 10 )['index'], - 'Almost stale; bad index' - ); - $this->assertSame( - null, - LBFactory::getCPInfoFromCookieValue( "2@$time#$agentId", $time + 11 - 10 )['index'], - 'Stale' - ); - - $this->assertSame( - $agentId, - LBFactory::getCPInfoFromCookieValue( "5@$time#$agentId", $time - 10 )['clientId'], - 'Live (client ID)' - ); - $this->assertSame( - null, - LBFactory::getCPInfoFromCookieValue( "5@$time#$agentId", $time + 11 - 10 )['clientId'], - 'Stale (client ID)' - ); - } - public function testGetChronologyProtectorTouched() { $store = new HashBagOStuff; $lbFactory = $this->newLBFactoryMulti( [ |