wiki.techinc.nl/tests/phpunit/unit/includes/page/ArticleTest.php
Max Semenik 48a323f702 tests: Add explicit return type void to setUp() and tearDown()
Bug: T192167
Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43
Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
2019-10-30 14:31:22 -07:00

57 lines
1.3 KiB
PHP

<?php
class ArticleTest extends MediaWikiUnitTestCase {
/**
* @var Title
*/
private $title;
/**
* @var Article
*/
private $article;
/** creates a title object and its article object */
protected function setUp() : void {
parent::setUp();
$this->title = Title::makeTitle( NS_MAIN, 'SomePage' );
$this->article = new Article( $this->title );
}
/** cleanup title object and its article object */
protected function tearDown() : void {
parent::tearDown();
$this->title = null;
$this->article = null;
}
/**
* @covers Article::__get
*/
public function testImplementsGetMagic() {
$this->assertFalse( $this->article->mLatest, "Article __get magic" );
}
/**
* @depends testImplementsGetMagic
* @covers Article::__set
*/
public function testImplementsSetMagic() {
$this->article->mLatest = 2;
$this->assertEquals( 2, $this->article->mLatest, "Article __set magic" );
}
/**
* @covers Article::__get
* @covers Article::__set
*/
public function testGetOrSetOnNewProperty() {
$this->article->ext_someNewProperty = 12;
$this->assertEquals( 12, $this->article->ext_someNewProperty,
"Article get/set magic on new field" );
$this->article->ext_someNewProperty = -8;
$this->assertEquals( -8, $this->article->ext_someNewProperty,
"Article get/set magic on update to new field" );
}
}