Skip to content

Commit

Permalink
Add stub special page (#7)
Browse files Browse the repository at this point in the history
* Add stub special page

* Try type hint
  • Loading branch information
malberts committed Nov 5, 2022
1 parent 5d9ccfe commit 8e30b1c
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 2 deletions.
7 changes: 7 additions & 0 deletions WikibaseExport.i18n.alias.php
@@ -0,0 +1,7 @@
<?php

$specialPageAliases = [];

$specialPageAliases['en'] = [
'WikibaseExport' => [ 'WikibaseExport' ],
];
5 changes: 5 additions & 0 deletions extension.json
Expand Up @@ -40,6 +40,7 @@
},

"SpecialPages": {
"WikibaseExport": "ProfessionalWiki\\WikibaseExport\\SpecialWikibaseExport"
},

"ResourceFileModulePaths": {
Expand All @@ -50,5 +51,9 @@
"ResourceModules": {
},

"ExtensionMessagesFiles": {
"WikibaseExportAlias": "WikibaseExport.i18n.alias.php"
},

"manifest_version": 2
}
4 changes: 3 additions & 1 deletion i18n/en.json
Expand Up @@ -5,5 +5,7 @@
]
},
"wikibase-export-name": "Wikibase Export",
"wikibase-export-description": "Adds a user-friendly Wikibase export page"
"wikibase-export-description": "Adds a user-friendly Wikibase export page",

"special-wikibase-export": "Wikibase Export"
}
3 changes: 2 additions & 1 deletion i18n/qqq.json
Expand Up @@ -6,5 +6,6 @@
]
},
"wikibase-rdf-name": "{{notranslate}}",
"wikibase-rdf-description": "{{Desc|name=Wikibase Export|url=https://github.com/ProfessionalWiki/WikibaseExport}}"
"wikibase-rdf-description": "{{Desc|name=Wikibase Export|url=https://github.com/ProfessionalWiki/WikibaseExport}}",
"special-wikibase-export": "This is the label on \"Special:WikibaseExport\"."
}
28 changes: 28 additions & 0 deletions src/SpecialWikibaseExport.php
@@ -0,0 +1,28 @@
<?php

declare( strict_types = 1 );

namespace ProfessionalWiki\WikibaseExport;

use SpecialPage;

class SpecialWikibaseExport extends SpecialPage {

public function __construct() {
parent::__construct( 'WikibaseExport' );
}

public function execute( $subPage ): void {
parent::execute( $subPage );
$this->getOutput()->addHTML( 'TODO' );
}

public function getGroupName(): string {
return 'wikibase';
}

public function getDescription(): string {
return $this->msg( 'special-wikibase-export' )->escaped();
}

}
29 changes: 29 additions & 0 deletions tests/SpecialWikibaseExportTest.php
@@ -0,0 +1,29 @@
<?php

declare( strict_types = 1 );

namespace ProfessionalWiki\WikibaseExport\Tests;

use ProfessionalWiki\WikibaseExport\SpecialWikibaseExport;
use SpecialPageTestBase;

/**
* @covers \ProfessionalWiki\WikibaseExport\SpecialWikibaseExport
*/
class SpecialWikibaseExportTest extends SpecialPageTestBase {

protected function newSpecialPage(): SpecialWikibaseExport {
return new SpecialWikibaseExport();
}

public function testStub(): void {
/** @var string $output */
list( $output ) = $this->executeSpecialPage();

$this->assertStringContainsString(
'TODO',
$output
);
}

}

0 comments on commit 8e30b1c

Please sign in to comment.