X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fdb%2FLBFactoryTest.php;h=82ca66a5fb219e208e777cfd2c4ddb679e984f0f;hb=44b47b43ee0df87d01ed40ecf0899137c5bb2b68;hp=fac34867d891ded6515feeea128338d4ed622520;hpb=5b426d00b17f939bbb78f7eedb987f74df6686c9;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/db/LBFactoryTest.php b/tests/phpunit/includes/db/LBFactoryTest.php index fac34867d8..82ca66a5fb 100644 --- a/tests/phpunit/includes/db/LBFactoryTest.php +++ b/tests/phpunit/includes/db/LBFactoryTest.php @@ -630,35 +630,41 @@ class LBFactoryTest extends MediaWikiTestCase { '1@542#c47dcfb0566e7d7bc110a6128a45c93a', LBFactory::makeCookieValueFromCPIndex( 1, 542, $agentId ) ); + $this->assertSame( - 5, - LBFactory::getCPInfoFromCookieValue( "5", $time - 10 )['index'], + null, + LBFactory::getCPInfoFromCookieValue( "5#$agentId", $time - 10 )['index'], 'No time set' ); $this->assertSame( null, - LBFactory::getCPInfoFromCookieValue( "0", $time - 10 )['index'], + 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", $time - 10 )['index'], + LBFactory::getCPInfoFromCookieValue( "2@$time#$agentId", $time - 10 )['index'], 'Fresh' ); $this->assertSame( 2, - LBFactory::getCPInfoFromCookieValue( "2@$time", $time + 9 - 10 )['index'], + LBFactory::getCPInfoFromCookieValue( "2@$time#$agentId", $time + 9 - 10 )['index'], 'Almost stale' ); $this->assertSame( null, - LBFactory::getCPInfoFromCookieValue( "0@$time", $time + 9 - 10 )['index'], + LBFactory::getCPInfoFromCookieValue( "0@$time#$agentId", $time + 9 - 10 )['index'], 'Almost stale; bad index' ); $this->assertSame( null, - LBFactory::getCPInfoFromCookieValue( "2@$time", $time + 11 - 10 )['index'], + LBFactory::getCPInfoFromCookieValue( "2@$time#$agentId", $time + 11 - 10 )['index'], 'Stale' ); @@ -669,7 +675,7 @@ class LBFactoryTest extends MediaWikiTestCase { ); $this->assertSame( null, - LBFactory::getCPInfoFromCookieValue( "5@$time", $time + 11 - 10 )['clientId'], + LBFactory::getCPInfoFromCookieValue( "5@$time#$agentId", $time + 11 - 10 )['clientId'], 'Stale (client ID)' ); }