Replace all uses of AbstractBlock::getTarget with Block ::getTargetName and ::getTargetUserIdentity. Create AbstractBlockTest and two test cases for AbstractBlock::getTarget and ::getTargetAndType. It tests triggering of the deprecation warning. Bug: T282247 Depends-On: I0543f363af66c57f5763b91320d87a69f23f9466 Change-Id: Iaeca824cac30172178de72f3cf7b7ae4cdd6f880
38 lines
845 B
PHP
38 lines
845 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Tests\Unit\Block;
|
|
|
|
use MediaWiki\Block\AbstractBlock;
|
|
use MediaWikiUnitTestCase;
|
|
|
|
/**
|
|
* @group Blocking
|
|
* @coversDefaultClass MediaWiki\Block\AbstractBlock
|
|
*/
|
|
class AbstractBlockTest extends MediaWikiUnitTestCase {
|
|
|
|
/**
|
|
* @covers ::getTarget
|
|
*/
|
|
public function testGetTarget_deprecated() {
|
|
$this->expectDeprecation();
|
|
$block = $this->createNoOpAbstractMock(
|
|
AbstractBlock::class,
|
|
[ 'getTarget' ]
|
|
);
|
|
$block->getTarget();
|
|
}
|
|
|
|
/**
|
|
* @covers ::getTargetAndType
|
|
*/
|
|
public function testGetTargetAndType_deprecated() {
|
|
$this->expectDeprecation();
|
|
$this->expectDeprecationMessageMatches( '/AbstractBlock::getTargetAndType was deprecated in MediaWiki 1.37/' );
|
|
$block = $this->createNoOpAbstractMock(
|
|
AbstractBlock::class,
|
|
[ 'getTargetAndType' ]
|
|
);
|
|
$block->getTargetAndType();
|
|
}
|
|
}
|