3 namespace MediaWiki\Tests\Maintenance
;
12 class DeleteTagTest
extends MaintenanceBaseTestCase
{
14 protected function getMaintenanceClass() {
15 return DeleteTag
::class;
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();
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/"
34 $this->expectCallToFatalError();
35 $this->maintenance
->execute();