| 1 |
<?php |
| 2 |
|
| 3 |
use MediaWiki\Permissions\UltimateAuthority; |
| 4 |
use MediaWiki\Specials\SpecialContribute; |
| 5 |
use MediaWiki\User\User; |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
class SpecialContributeTest extends SpecialPageTestBase { |
| 13 |
|
| 14 |
private $pageName = __CLASS__ . 'BlaBlaTest'; |
| 15 |
|
| 16 |
|
| 17 |
private $admin; |
| 18 |
|
| 19 |
|
| 20 |
private $specialContribute; |
| 21 |
|
| 22 |
protected function setUp(): void { |
| 23 |
parent::setUp(); |
| 24 |
$this->admin = new UltimateAuthority( $this->getTestSysop()->getUser() ); |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
public function testExecute() { |
| 31 |
$this->specialContribute = new SpecialContribute(); |
| 32 |
[ $html ] = $this->executeSpecialPage( |
| 33 |
$this->admin->getUser()->getName(), |
| 34 |
null, |
| 35 |
'qqx', |
| 36 |
$this->admin, |
| 37 |
true |
| 38 |
); |
| 39 |
$this->assertStringContainsString( '<div class="mw-contribute-wrapper">', $html ); |
| 40 |
$this->assertStringContainsString( '<div class="mw-contribute-card-content">', $html ); |
| 41 |
} |
| 42 |
|
| 43 |
public function testIsShowable() { |
| 44 |
$this->specialContribute = new SpecialContribute(); |
| 45 |
$this->executeSpecialPage( |
| 46 |
$this->admin->getUser()->getName(), |
| 47 |
null, |
| 48 |
'qqx', |
| 49 |
$this->admin, |
| 50 |
true |
| 51 |
); |
| 52 |
$this->assertFalse( $this->specialContribute->isShowable() ); |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
protected function newSpecialPage(): SpecialContribute { |
| 59 |
return $this->specialContribute; |
| 60 |
} |
| 61 |
|
| 62 |
} |