mediawiki-skins-Citizen/tests/phpunit/Partials/PageTitleTest.php
H. C. Kruse 661ad61486
ci: add PHPUnit tests (#712)
* ci: WIP add PHP Unit Tests

* ci: 👷 lint code to MediaWiki standards

Check commit and GitHub actions for more details

* ci: Add phpunit tests

---------

Co-authored-by: github-actions <github-actions@users.noreply.github.com>
2023-08-25 14:39:37 -07:00

50 lines
1.3 KiB
PHP

<?php
declare( strict_types=1 );
namespace MediaWiki\Skins\Citizen\Tests\Partials;
use MediaWiki\Skins\Citizen\Partials\PageTitle;
use MediaWiki\Skins\Citizen\SkinCitizen;
use MediaWiki\Title\Title;
use MediaWikiIntegrationTestCase;
use MWException;
use RequestContext;
/**
* @group Citizen
*/
class PageTitleTest extends MediaWikiIntegrationTestCase {
/**
* @covers \MediaWiki\Skins\Citizen\Partials\PageTitle
* @return void
* @throws MWException
*/
public function testDecorateTitleNoParenthesis() {
$title = Title::makeTitle( NS_PROJECT, 'Foo' );
RequestContext::resetMain();
RequestContext::getMain()->setTitle( $title );
$partial = new PageTitle( new SkinCitizen() );
$text = $partial->decorateTitle( 'Foo Title (paren)' );
$this->assertStringNotContainsString( 'mw-page-title-parenthesis', $text );
}
/**
* @covers \MediaWiki\Skins\Citizen\Partials\PageTitle
* @return void
* @throws MWException
*/
public function testDecorateTitle() {
$title = Title::makeTitle( NS_MAIN, 'Foo' );
RequestContext::resetMain();
RequestContext::getMain()->setTitle( $title );
$partial = new PageTitle( new SkinCitizen() );
$text = $partial->decorateTitle( 'Foo Title (paren)' );
$this->assertStringContainsString( 'mw-page-title-parenthesis', $text );
}
}