mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/PageImages
synced 2024-11-15 03:43:46 +00:00
382c70f981
The API accepts a new query parameter `license`, whose value can either be `free` or `any`. `free` is the default value. When the value of `licence` is: * `free`, then only the best image whose copyright allows reusing it will be returned; * `any`, then the best image, regardless of its copyright status, will be returned. Bug: T131105 Change-Id: I83ac5266e382d2d121aff3f7d28711787251c03b
42 lines
975 B
PHP
42 lines
975 B
PHP
<?php
|
|
|
|
namespace PageImages\Tests;
|
|
|
|
use MediaWikiTestCase;
|
|
use PageImages;
|
|
use Title;
|
|
|
|
/**
|
|
* @covers PageImages
|
|
*
|
|
* @group PageImages
|
|
* @group Database
|
|
*
|
|
* @license WTFPL 2.0
|
|
* @author Thiemo Mättig
|
|
*/
|
|
class PageImagesTest extends MediaWikiTestCase {
|
|
|
|
public function testPagePropertyNames() {
|
|
$this->assertSame( 'page_image', PageImages::PROP_NAME );
|
|
$this->assertSame( 'page_image_free', PageImages::PROP_NAME_FREE );
|
|
}
|
|
|
|
public function testConstructor() {
|
|
$pageImages = new PageImages();
|
|
$this->assertInstanceOf( 'PageImages', $pageImages );
|
|
}
|
|
|
|
public function testGivenNonExistingPage_getPageImageReturnsFalse() {
|
|
$title = Title::newFromText( wfRandomString() );
|
|
$title->resetArticleID( 0 );
|
|
|
|
$this->assertFalse( PageImages::getPageImage( $title ) );
|
|
}
|
|
|
|
public function testGetPropName() {
|
|
$this->assertSame( 'page_image', PageImages::getPropName( false ) );
|
|
$this->assertSame( 'page_image_free', PageImages::getPropName( true ) );
|
|
}
|
|
}
|