split tests for ArticleTest
This commit is contained in:
parent
b42793e4a8
commit
2fad923859
1 changed files with 52 additions and 20 deletions
|
|
@ -1,34 +1,66 @@
|
|||
<?php
|
||||
|
||||
class ArticleTest extends MediaWikiTestCase {
|
||||
function testBCMagic() {
|
||||
$title = Title::makeTitle( NS_MAIN, 'somePage' );
|
||||
$article = new Article( $title );
|
||||
|
||||
private $title; // holds a Title object
|
||||
private $article; // holds an article
|
||||
|
||||
/** creates a title object and its article object */
|
||||
function setUp() {
|
||||
$this->title = Title::makeTitle( NS_MAIN, 'somePage' );
|
||||
$this->article = new Article( $this->title );
|
||||
|
||||
}
|
||||
|
||||
/** cleanup title object and its article object */
|
||||
function tearDown() {
|
||||
$this->title = null;
|
||||
$this->article = null;
|
||||
|
||||
}
|
||||
|
||||
function testImplementsGetMagic() {
|
||||
$this->assertEquals( -1, $this->article->mCounter, "Article __get magic" );
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testImplementsGetMagic
|
||||
*/
|
||||
function testImplementsSetMagic() {
|
||||
|
||||
$this->article->mCounter = 2;
|
||||
$this->assertEquals( 2, $this->article->mCounter, "Article __set magic" );
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testImplementsSetMagic
|
||||
*/
|
||||
function testImplementsCallMagic() {
|
||||
$this->article->mCounter = 33;
|
||||
$this->assertEquals( 33, $this->article->getCount(), "Article __call magic" );
|
||||
}
|
||||
|
||||
function testGetOrSetOnNewProperty() {
|
||||
$this->article->ext_someNewProperty = 12;
|
||||
$this->assertEquals( 12, $this->article->ext_someNewProperty,
|
||||
"Article get/set magic on new field" );
|
||||
|
||||
$this->assertEquals( -1, $article->mCounter, "Article __get magic" );
|
||||
|
||||
$article->mCounter = 2;
|
||||
$this->assertEquals( 2, $article->mCounter, "Article __set magic" );
|
||||
|
||||
$this->assertEquals( 2, $article->getCount(), "Article __call magic" );
|
||||
$this->article->ext_someNewProperty = -8;
|
||||
$this->assertEquals( -8, $this->article->ext_someNewProperty,
|
||||
"Article get/set magic on update to new field" );
|
||||
}
|
||||
|
||||
function testStaticFunctions() {
|
||||
$this->assertEquals( WikiPage::selectFields(), Article::selectFields(),
|
||||
"Article static functions" );
|
||||
$this->assertEquals( null, Article::onArticleCreate( $title ),
|
||||
$this->assertEquals( null, Article::onArticleCreate( $this->title ),
|
||||
"Article static functions" );
|
||||
$this->assertEquals( null, Article::onArticleDelete( $title ),
|
||||
$this->assertEquals( null, Article::onArticleDelete( $this->title ),
|
||||
"Article static functions" );
|
||||
$this->assertEquals( null, ImagePage::onArticleEdit( $title ),
|
||||
$this->assertEquals( null, ImagePage::onArticleEdit( $this->title ),
|
||||
"Article static functions" );
|
||||
$this->assertTrue( is_string( CategoryPage::getAutosummary( '', '', 0 ) ),
|
||||
"Article static functions" );
|
||||
|
||||
$article->ext_someNewProperty = 12;
|
||||
$this->assertEquals( 12, $article->ext_someNewProperty,
|
||||
"Article get/set magic on new field" );
|
||||
|
||||
$article->ext_someNewProperty = -8;
|
||||
$this->assertEquals( -8, $article->ext_someNewProperty,
|
||||
"Article get/set magic on update to new field" );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue