Debian Codegraph @

tests/phpunit/maintenance/DeleteTagTest.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Tests\Maintenance;
4
5 use DeleteTag;
6
7 /**
8 * @covers DeleteTag
9 * @group Database
10 * @author Dreamy Jazz
11 */
12 class DeleteTagTest extends MaintenanceBaseTestCase {
13
14 protected function getMaintenanceClass() {
15 return DeleteTag::class;
16 }
17
18 public function testExecuteForNonExistingTag() {
19 $this->maintenance->setArg( 'tag name', 'abcedef' );
20 $this->expectOutputRegex( "/Tag 'abcedef' not found/" );
21 $this->expectCallToFatalError();
22 $this->maintenance->execute();
23 }
24
25 public function testExecuteForSoftwareDefinedTag() {
26 // Get a page which has a mw-blank tag
27 $testPage = $this->getExistingTestPage();
28 $this->editPage( $testPage, '' );
29 // Run the maintenance script and try to remove the mw-blank tag
30 $this->maintenance->setArg( 'tag name', 'mw-blank' );
31 $this->expectOutputRegex(
32 "/Tags defined by an extension cannot be deleted unless the extension specifically allows it/"
33 );
34 $this->expectCallToFatalError();
35 $this->maintenance->execute();
36 }
37 }