From: Timo Tijhof Date: Sun, 25 Aug 2019 15:04:19 +0000 (+0100) Subject: title: Fix flaky TitlePermissionTest::testUserBlock X-Git-Tag: 1.34.0-rc.0~583^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/li_csstidy.html?a=commitdiff_plain;h=b9f19780422322a8e6ff9195b6458af2f6d7f2dd;p=lhc%2Fweb%2Fwiklou.git 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 --- 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',