From b9f19780422322a8e6ff9195b6458af2f6d7f2dd Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sun, 25 Aug 2019 16:04:19 +0100 Subject: [PATCH] title: Fix flaky TitlePermissionTest::testUserBlock The mock timestamp is asserted via $prev, which is set a few lines up. The input timestamp is set as 0, which usually passes (if these two lines execute in the same second), but when the two lines of code are on opposite sides of a clock second boundary, the test would fail. Instead of fixing the setTimestamp() call, remove it in favour of fixing the 'timestamp' option instead, which was needlessly being set to one thing and then overwritten by setTimestamp. Bug: T231166 Change-Id: If6a1e4ec7b91efee0a43e6dd86794f15c5a440b3 --- tests/phpunit/includes/TitlePermissionTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/phpunit/includes/TitlePermissionTest.php b/tests/phpunit/includes/TitlePermissionTest.php index e6cf8c8b89..208b955681 100644 --- a/tests/phpunit/includes/TitlePermissionTest.php +++ b/tests/phpunit/includes/TitlePermissionTest.php @@ -942,11 +942,10 @@ class TitlePermissionTest extends MediaWikiLangTestCase { 'address' => '127.0.8.1', 'by' => $this->user->getId(), 'reason' => 'no reason given', - 'timestamp' => $prev + 3600, + 'timestamp' => $prev, 'auto' => true, 'expiry' => 0 ] ); - $this->user->mBlock->setTimestamp( 0 ); $this->assertEquals( [ [ 'autoblockedtext', "[[User:Useruser|\u{202A}Useruser\u{202C}]]", 'no reason given', '127.0.0.1', "\u{202A}Useruser\u{202C}", null, 'infinite', '127.0.8.1', -- 2.20.1