2011-06-29 22:09:51 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
class ArticleTest extends MediaWikiTestCase {
|
|
|
|
|
|
2012-10-08 10:56:20 +00:00
|
|
|
/**
|
|
|
|
|
* @var Title
|
|
|
|
|
*/
|
|
|
|
|
private $title;
|
|
|
|
|
/**
|
|
|
|
|
* @var Article
|
|
|
|
|
*/
|
|
|
|
|
private $article;
|
2011-07-03 17:51:11 +00:00
|
|
|
|
|
|
|
|
/** creates a title object and its article object */
|
2012-10-08 10:56:20 +00:00
|
|
|
protected function setUp() {
|
2012-10-23 17:02:36 +00:00
|
|
|
parent::setUp();
|
2012-10-08 10:56:20 +00:00
|
|
|
$this->title = Title::makeTitle( NS_MAIN, 'SomePage' );
|
2011-07-03 17:51:11 +00:00
|
|
|
$this->article = new Article( $this->title );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** cleanup title object and its article object */
|
2012-10-08 10:56:20 +00:00
|
|
|
protected function tearDown() {
|
2012-10-23 17:02:36 +00:00
|
|
|
parent::tearDown();
|
2012-10-08 10:56:20 +00:00
|
|
|
$this->title = null;
|
2011-07-03 17:51:11 +00:00
|
|
|
$this->article = null;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 10:54:02 +00:00
|
|
|
/**
|
|
|
|
|
* @covers Article::__get
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testImplementsGetMagic() {
|
2011-12-11 13:29:21 +00:00
|
|
|
$this->assertEquals( false, $this->article->mLatest, "Article __get magic" );
|
2011-07-03 17:51:11 +00:00
|
|
|
}
|
2011-06-29 22:09:51 +00:00
|
|
|
|
2011-07-03 17:51:11 +00:00
|
|
|
/**
|
|
|
|
|
* @depends testImplementsGetMagic
|
2013-10-24 10:54:02 +00:00
|
|
|
* @covers Article::__set
|
2011-07-03 17:51:11 +00:00
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testImplementsSetMagic() {
|
2011-12-11 13:29:21 +00:00
|
|
|
$this->article->mLatest = 2;
|
|
|
|
|
$this->assertEquals( 2, $this->article->mLatest, "Article __set magic" );
|
2011-07-03 17:51:11 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-24 10:54:02 +00:00
|
|
|
/**
|
|
|
|
|
* @covers Article::__get
|
|
|
|
|
* @covers Article::__set
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testGetOrSetOnNewProperty() {
|
2011-07-03 17:51:11 +00:00
|
|
|
$this->article->ext_someNewProperty = 12;
|
|
|
|
|
$this->assertEquals( 12, $this->article->ext_someNewProperty,
|
|
|
|
|
"Article get/set magic on new field" );
|
2013-02-14 11:22:13 +00:00
|
|
|
|
2011-07-03 17:51:11 +00:00
|
|
|
$this->article->ext_someNewProperty = -8;
|
|
|
|
|
$this->assertEquals( -8, $this->article->ext_someNewProperty,
|
|
|
|
|
"Article get/set magic on update to new field" );
|
|
|
|
|
}
|
2011-06-29 22:09:51 +00:00
|
|
|
}
|