MediaWiki  1.23.2
ArticleTest.php
Go to the documentation of this file.
1 <?php
2 
4 
8  private $title;
12  private $article;
13 
15  protected function setUp() {
16  parent::setUp();
17  $this->title = Title::makeTitle( NS_MAIN, 'SomePage' );
18  $this->article = new Article( $this->title );
19  }
20 
22  protected function tearDown() {
23  parent::tearDown();
24  $this->title = null;
25  $this->article = null;
26  }
27 
31  public function testImplementsGetMagic() {
32  $this->assertEquals( false, $this->article->mLatest, "Article __get magic" );
33  }
34 
39  public function testImplementsSetMagic() {
40  $this->article->mLatest = 2;
41  $this->assertEquals( 2, $this->article->mLatest, "Article __set magic" );
42  }
43 
48  public function testImplementsCallMagic() {
49  $this->article->mLatest = 33;
50  $this->article->mDataLoaded = true;
51  $this->assertEquals( 33, $this->article->getLatest(), "Article __call magic" );
52  }
53 
58  public function testGetOrSetOnNewProperty() {
59  $this->article->ext_someNewProperty = 12;
60  $this->assertEquals( 12, $this->article->ext_someNewProperty,
61  "Article get/set magic on new field" );
62 
63  $this->article->ext_someNewProperty = -8;
64  $this->assertEquals( -8, $this->article->ext_someNewProperty,
65  "Article get/set magic on update to new field" );
66  }
67 
76  public function testStaticFunctions() {
77  $this->hideDeprecated( 'Article::getAutosummary' );
78  $this->hideDeprecated( 'WikiPage::getAutosummary' );
79  $this->hideDeprecated( 'CategoryPage::getAutosummary' ); // Inherited from Article
80 
81  $this->assertEquals( WikiPage::selectFields(), Article::selectFields(),
82  "Article static functions" );
83  $this->assertEquals( true, is_callable( "Article::onArticleCreate" ),
84  "Article static functions" );
85  $this->assertEquals( true, is_callable( "Article::onArticleDelete" ),
86  "Article static functions" );
87  $this->assertEquals( true, is_callable( "ImagePage::onArticleEdit" ),
88  "Article static functions" );
89  $this->assertTrue( is_string( CategoryPage::getAutosummary( '', '', 0 ) ),
90  "Article static functions" );
91  }
92 }
Title\makeTitle
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:398
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ArticleTest\$article
Article $article
Definition: ArticleTest.php:10
ArticleTest\testStaticFunctions
testStaticFunctions()
Checks for the existence of the backwards compatibility static functions (forwarders to WikiPage clas...
Definition: ArticleTest.php:74
ArticleTest\testImplementsSetMagic
testImplementsSetMagic()
@depends testImplementsGetMagic @covers Article::__set
Definition: ArticleTest.php:37
Article\getAutosummary
static getAutosummary( $oldtext, $newtext, $flags)
Definition: Article.php:2140
NS_MAIN
const NS_MAIN
Definition: Defines.php:79
title
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
Definition: All_system_messages.txt:2703
article
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an article
Definition: design.txt:25
WikiPage\selectFields
static selectFields()
Return the list of revision fields that should be selected to create a new page.
Definition: WikiPage.php:271
MediaWikiTestCase
Definition: MediaWikiTestCase.php:6
ArticleTest\testImplementsGetMagic
testImplementsGetMagic()
@covers Article::__get
Definition: ArticleTest.php:29
MediaWikiTestCase\hideDeprecated
hideDeprecated( $function)
Don't throw a warning if $function is deprecated and called later.
Definition: MediaWikiTestCase.php:679
ArticleTest\testGetOrSetOnNewProperty
testGetOrSetOnNewProperty()
@covers Article::__get @covers Article::__set
Definition: ArticleTest.php:56
ArticleTest
Definition: ArticleTest.php:3
ArticleTest\setUp
setUp()
creates a title object and its article object
Definition: ArticleTest.php:13
Title
Represents a title within MediaWiki.
Definition: Title.php:35
Article\selectFields
static selectFields()
Definition: Article.php:2108
ArticleTest\testImplementsCallMagic
testImplementsCallMagic()
@depends testImplementsSetMagic @covers Article::__call
Definition: ArticleTest.php:46
ArticleTest\tearDown
tearDown()
cleanup title object and its article object
Definition: ArticleTest.php:20
Article
Class for viewing MediaWiki article and history.
Definition: Article.php:36
ArticleTest\$title
Title $title
Definition: ArticleTest.php:7