The not-namespaced classes are deprecated since change I735222c437
(commit ea2979b8ca) and other changes.
Also use the recommendation for @covers from
https://docs.phpunit.de/en/10.3/annotations.html#covers
> Please note that this annotation requires a fully-qualified class
> name (FQCN). To make this more obvious to the reader, it is
> recommended to use a leading backslash (even if this not required
> for the annotation to work correctly).
Update the test class names and file names
from SpecialBooksourcesTest to SpecialBookSourcesTest,
from SpecialRecentchangesTest to SpecialRecentChangesTest and
from SpecialRandomTest to SpecialRandomPageTest
to match the corresponding special page class names.
Change-Id: I3c0e80c6219c5085e28338601617599e09bd05de
62 lines
1.4 KiB
PHP
62 lines
1.4 KiB
PHP
<?php
|
|
|
|
use MediaWiki\Permissions\UltimateAuthority;
|
|
use MediaWiki\Specials\SpecialContribute;
|
|
use MediaWiki\User\User;
|
|
|
|
/**
|
|
* @author MAbualruz
|
|
* @group Database
|
|
* @covers \MediaWiki\Specials\SpecialContribute
|
|
*/
|
|
class SpecialContributeTest extends SpecialPageTestBase {
|
|
/** @var string */
|
|
private $pageName = __CLASS__ . 'BlaBlaTest';
|
|
|
|
/** @var User */
|
|
private $admin;
|
|
|
|
/** @var SpecialContribute */
|
|
private $specialContribute;
|
|
|
|
protected function setUp(): void {
|
|
parent::setUp();
|
|
$this->admin = new UltimateAuthority( $this->getTestSysop()->getUser() );
|
|
}
|
|
|
|
/**
|
|
* @covers \MediaWiki\Specials\SpecialContribute::execute
|
|
*/
|
|
public function testExecute() {
|
|
$this->specialContribute = new SpecialContribute();
|
|
list( $html ) = $this->executeSpecialPage(
|
|
$this->admin->getUser()->getName(),
|
|
null,
|
|
'qqx',
|
|
$this->admin,
|
|
true
|
|
);
|
|
$this->assertStringContainsString( '<div class="mw-contribute-wrapper">', $html );
|
|
$this->assertStringContainsString( '<div class="mw-contribute-card-content">', $html );
|
|
}
|
|
|
|
public function testIsShowable() {
|
|
$this->specialContribute = new SpecialContribute();
|
|
$this->executeSpecialPage(
|
|
$this->admin->getUser()->getName(),
|
|
null,
|
|
'qqx',
|
|
$this->admin,
|
|
true
|
|
);
|
|
$this->assertFalse( $this->specialContribute->isShowable() );
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
protected function newSpecialPage(): SpecialContribute {
|
|
return $this->specialContribute;
|
|
}
|
|
|
|
}
|