User mock must return Block instance from getBlock.

Change-Id: I569e91dd07b8f89af42344b6d6df87560dcb6bbe
Needed-By: T271494
This commit is contained in:
daniel 2021-06-08 17:12:48 +02:00
parent b592251616
commit 54285fe984

View file

@ -5,6 +5,7 @@ namespace MediaWiki\Extension\AbuseFilter\Tests\Unit;
use Generator;
use Language;
use LogicException;
use MediaWiki\Block\SystemBlock;
use MediaWiki\Extension\AbuseFilter\Hooks\AbuseFilterHookRunner;
use MediaWiki\Extension\AbuseFilter\Parser\AFPData;
use MediaWiki\Extension\AbuseFilter\TextExtractor;
@ -204,10 +205,10 @@ class LazyVariableComputerTest extends MediaWikiUnitTestCase {
$var = $getUserVar( $user, 'user-rights' );
yield 'user_rights' => [ $var, $rights, [ null, null, $permissionManager ] ];
$blocked = true;
$user->method( 'getBlock' )->willReturn( $blocked );
$block = new SystemBlock( [] );
$user->method( 'getBlock' )->willReturn( $block );
$var = $getUserVar( $user, 'user-block' );
yield 'user_blocked' => [ $var, $blocked ];
yield 'user_blocked' => [ $var, (bool)$block ];
$fakeTime = 1514700000;