MediaWiki  1.30.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 testGetOrSetOnNewProperty() {
49  $this->article->ext_someNewProperty = 12;
50  $this->assertEquals( 12, $this->article->ext_someNewProperty,
51  "Article get/set magic on new field" );
52 
53  $this->article->ext_someNewProperty = -8;
54  $this->assertEquals( -8, $this->article->ext_someNewProperty,
55  "Article get/set magic on update to new field" );
56  }
57 
67  public function testStaticFunctions() {
68  $this->hideDeprecated( 'Article::selectFields' );
69 
70  $this->assertEquals( WikiPage::selectFields(), Article::selectFields(),
71  "Article static functions" );
72  $this->assertEquals( true, is_callable( "Article::onArticleCreate" ),
73  "Article static functions" );
74  $this->assertEquals( true, is_callable( "Article::onArticleDelete" ),
75  "Article static functions" );
76  $this->assertEquals( true, is_callable( "ImagePage::onArticleEdit" ),
77  "Article static functions" );
78  }
79 }
ArticleTest\$article
Article $article
Definition: ArticleTest.php:12
ArticleTest\testStaticFunctions
testStaticFunctions()
Checks for the existence of the backwards compatibility static functions (forwarders to WikiPage clas...
Definition: ArticleTest.php:67
ArticleTest\testImplementsSetMagic
testImplementsSetMagic()
@depends testImplementsGetMagic Article::__set
Definition: ArticleTest.php:39
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
NS_MAIN
const NS_MAIN
Definition: Defines.php:65
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:2696
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:288
MediaWikiTestCase
Definition: MediaWikiTestCase.php:15
ArticleTest\testImplementsGetMagic
testImplementsGetMagic()
Article::__get.
Definition: ArticleTest.php:31
MediaWikiTestCase\hideDeprecated
hideDeprecated( $function)
Don't throw a warning if $function is deprecated and called later.
Definition: MediaWikiTestCase.php:1467
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:529
ArticleTest\testGetOrSetOnNewProperty
testGetOrSetOnNewProperty()
Article::__get Article::__set.
Definition: ArticleTest.php:48
ArticleTest
Definition: ArticleTest.php:3
ArticleTest\setUp
setUp()
creates a title object and its article object
Definition: ArticleTest.php:15
Title
Represents a title within MediaWiki.
Definition: Title.php:39
Article\selectFields
static selectFields()
Definition: Article.php:2664
ArticleTest\tearDown
tearDown()
cleanup title object and its article object
Definition: ArticleTest.php:22
Article
Class for viewing MediaWiki article and history.
Definition: Article.php:35
ArticleTest\$title
Title $title
Definition: ArticleTest.php:8