MediaWiki REL1_34
PageImagesTest.php
Go to the documentation of this file.
1<?php
2
3namespace PageImages\Tests;
4
6use MediaWikiTestCase;
7use OutputPage;
8use PageImages;
10use Title;
11
21class PageImagesTest extends MediaWikiTestCase {
22
23 public function testPagePropertyNames() {
24 $this->assertSame( 'page_image', PageImages::PROP_NAME );
25 $this->assertSame( 'page_image_free', PageImages::PROP_NAME_FREE );
26 }
27
28 public function testConstructor() {
29 $pageImages = new PageImages();
30 $this->assertInstanceOf( 'PageImages', $pageImages );
31 }
32
34 $title = $this->newTitle();
35 $this->assertFalse( PageImages::getPageImage( $title ) );
36 }
37
38 public function testGetPropName() {
39 $this->assertSame( 'page_image', PageImages::getPropName( false ) );
40 $this->assertSame( 'page_image_free', PageImages::getPropName( true ) );
41 }
42
44 $context = $this->getMock( IContextSource::class );
45 $context->method( 'getTitle' )
46 ->will( $this->returnValue( $this->newTitle() ) );
47
48 $outputPage = $this->getMock(
49 OutputPage::class, [ 'addMeta' ], [ $context ] );
50 $outputPage->expects( $this->never() )
51 ->method( 'addMeta' );
52
53 $skinTemplate = new SkinTemplate();
54 PageImages::onBeforePageDisplay( $outputPage, $skinTemplate );
55 }
56
60 private function newTitle() {
61 $title = Title::newFromText( 'New' );
62 $title->resetArticleID( 0 );
63 return $title;
64 }
65
66}
This is one of the Core classes and should be read at least once by any new developers.
Base class for template-based skins.
Represents a title within MediaWiki.
Definition Title.php:42
Interface for objects which can provide a MediaWiki context on request.
$context
Definition load.php:45