mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-24 06:54:00 +00:00
ab3063fee5
This patch does intentionally not touch any file name. Some of the file names are a little weird now, e.g. \Cite\Cite. These can more easily be renamed in later patches. I used https://codesearch.wmflabs.org/search/?q=new%20Cite%5C( and it looks like this code is not used anywhere else. Change-Id: I5f93a224e9cacf45b7a0d68c216a78723364dd96
54 lines
1.2 KiB
PHP
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 );
|
|
}
|
|
|
|
}
|