wiki.techinc.nl/tests/phpunit/includes/page/ArticleTest.php
Timo Tijhof 4193700b19 Add missing namespace to @covers comments
PHP_CodeCoverage_Exception:
> Trying to @cover not existing method "SwiftFileBackend::sanitzeHdrs".
> Trying to @cover not existing method "LineFormatter::normalizeException".
> Trying to @cover not existing method "MonologSpi::mergeConfig".
> Trying to @cover not existing method "ProcessCacheLRU::het".
> Trying to @cover not existing method "BitmapHandler::swapICCProfile".
> Trying to @cover not existing class or interface "checkParseSafety".
> Trying to @cover not existing method "Article::__call". (was removed).
> Trying to @cover not existing method "ExtensionProcessor::extracttExtensionMessagesFiles".
> Trying to @cover not existing method "FileContentsHasher::getFileContentHash".

Makes code coverage run fail at the moment. These used to be warnings
in PHPUnit 3.x, but are now hard exceptions in PHPUnit 4.x when requesting
a coverage report.

Change-Id: If7f45ca57fd7d480d35b1414a889398837c0c472
2016-02-23 03:56:49 +00:00

85 lines
2.4 KiB
PHP

<?php
class ArticleTest extends MediaWikiTestCase {
/**
* @var Title
*/
private $title;
/**
* @var Article
*/
private $article;
/** creates a title object and its article object */
protected function setUp() {
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() {
parent::tearDown();
$this->title = null;
$this->article = null;
}
/**
* @covers Article::__get
*/
public function testImplementsGetMagic() {
$this->assertEquals( false, $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" );
}
/**
* Checks for the existence of the backwards compatibility static functions
* (forwarders to WikiPage class)
*
* @covers Article::selectFields
* @covers Article::onArticleCreate
* @covers Article::onArticleDelete
* @covers Article::onArticleEdit
* @covers Article::getAutosummary
*/
public function testStaticFunctions() {
$this->hideDeprecated( 'Article::selectFields' );
$this->hideDeprecated( 'Article::getAutosummary' );
$this->hideDeprecated( 'WikiPage::getAutosummary' );
$this->hideDeprecated( 'CategoryPage::getAutosummary' ); // Inherited from Article
$this->assertEquals( WikiPage::selectFields(), Article::selectFields(),
"Article static functions" );
$this->assertEquals( true, is_callable( "Article::onArticleCreate" ),
"Article static functions" );
$this->assertEquals( true, is_callable( "Article::onArticleDelete" ),
"Article static functions" );
$this->assertEquals( true, is_callable( "ImagePage::onArticleEdit" ),
"Article static functions" );
$this->assertTrue( is_string( CategoryPage::getAutosummary( '', '', 0 ) ),
"Article static functions" );
}
}