Changed quoting function for oracleDB.
[mediawiki.git] / tests / phpunit / includes / ArticleTest.php
blob867c4f007be35f550dd3fc00a98e828a1011e9e5
1 <?php
3 class ArticleTest extends MediaWikiTestCase {
5 /**
6 * @var Title
7 */
8 private $title;
9 /**
10 * @var Article
12 private $article;
14 /** creates a title object and its article object */
15 protected function setUp() {
16 parent::setUp();
17 $this->title = Title::makeTitle( NS_MAIN, 'SomePage' );
18 $this->article = new Article( $this->title );
21 /** cleanup title object and its article object */
22 protected function tearDown() {
23 parent::tearDown();
24 $this->title = null;
25 $this->article = null;
28 function testImplementsGetMagic() {
29 $this->assertEquals( false, $this->article->mLatest, "Article __get magic" );
32 /**
33 * @depends testImplementsGetMagic
35 function testImplementsSetMagic() {
36 $this->article->mLatest = 2;
37 $this->assertEquals( 2, $this->article->mLatest, "Article __set magic" );
40 /**
41 * @depends testImplementsSetMagic
43 function testImplementsCallMagic() {
44 $this->article->mLatest = 33;
45 $this->article->mDataLoaded = true;
46 $this->assertEquals( 33, $this->article->getLatest(), "Article __call magic" );
49 function testGetOrSetOnNewProperty() {
50 $this->article->ext_someNewProperty = 12;
51 $this->assertEquals( 12, $this->article->ext_someNewProperty,
52 "Article get/set magic on new field" );
54 $this->article->ext_someNewProperty = -8;
55 $this->assertEquals( -8, $this->article->ext_someNewProperty,
56 "Article get/set magic on update to new field" );
59 /**
60 * Checks for the existence of the backwards compatibility static functions (forwarders to WikiPage class)
62 function testStaticFunctions() {
63 $this->hideDeprecated( 'Article::getAutosummary' );
64 $this->hideDeprecated( 'WikiPage::getAutosummary' );
65 $this->hideDeprecated( 'CategoryPage::getAutosummary' ); // Inherited from Article
67 $this->assertEquals( WikiPage::selectFields(), Article::selectFields(),
68 "Article static functions" );
69 $this->assertEquals( true, is_callable( "Article::onArticleCreate" ),
70 "Article static functions" );
71 $this->assertEquals( true, is_callable( "Article::onArticleDelete" ),
72 "Article static functions" );
73 $this->assertEquals( true, is_callable( "ImagePage::onArticleEdit" ),
74 "Article static functions" );
75 $this->assertTrue( is_string( CategoryPage::getAutosummary( '', '', 0 ) ),
76 "Article static functions" );
79 function testWikiPageFactory() {
80 $title = Title::makeTitle( NS_FILE, 'Someimage.png' );
81 $page = WikiPage::factory( $title );
82 $this->assertEquals( 'WikiFilePage', get_class( $page ) );
84 $title = Title::makeTitle( NS_CATEGORY, 'SomeCategory' );
85 $page = WikiPage::factory( $title );
86 $this->assertEquals( 'WikiCategoryPage', get_class( $page ) );
88 $title = Title::makeTitle( NS_MAIN, 'SomePage' );
89 $page = WikiPage::factory( $title );
90 $this->assertEquals( 'WikiPage', get_class( $page ) );