mediawiki-extensions-Cite/tests/phpunit/CiteTest.php
Thiemo Kreuz 22627f074d Make the normalizeKey() method private
There was a call in the API that was *not* using normalizeKey(). Now
that the API is gone, we can inline this.

This patch also contains a bunch of cleanups that might already been
resolved in the previous patches.

Change-Id: Id3767b5830268c8cfe9c10efabfa4a31e9dafeb8
2019-11-29 19:02:48 +01:00

54 lines
1.2 KiB
PHP

<?php
namespace Cite\Tests;
use Cite\Cite;
use Language;
use Parser;
use ParserOptions;
use ParserOutput;
use StripState;
/**
* @coversDefaultClass \Cite\Cite
*
* @license GPL-2.0-or-later
*/
class CiteTest extends \MediaWikiIntegrationTestCase {
protected function setUp() : void {
parent::setUp();
$this->setMwGlobals( [
'wgCiteBookReferencing' => true,
] );
}
/**
* @covers ::guardedRef
*/
public function testBookExtendsPageProperty() {
$mockOutput = $this->createMock( ParserOutput::class );
$mockOutput->expects( $this->once() )
->method( 'setProperty' )
->with( Cite::BOOK_REF_PROPERTY, true );
$parserOptions = $this->createMock( ParserOptions::class );
$parserOptions->method( 'getUserLangObj' )
->willReturn( $this->createMock( Language::class ) );
$mockParser = $this->createMock( Parser::class );
$mockParser->method( 'getOptions' )
->willReturn( $parserOptions );
$mockParser->method( 'getOutput' )
->willReturn( $mockOutput );
$mockParser->method( 'getStripState' )
->willReturn( $this->createMock( StripState::class ) );
$cite = new Cite();
$cite->ref( 'contentA', [ 'name' => 'a' ], $mockParser );
$cite->ref( 'contentB', [ Cite::BOOK_REF_ATTRIBUTE => 'a' ], $mockParser );
}
}