MediaWiki  1.23.2
TiffTest.php
Go to the documentation of this file.
1 <?php
2 class TiffTest extends MediaWikiTestCase {
3 
5  protected $handler;
7  protected $filePath;
8 
9  protected function setUp() {
10  parent::setUp();
11  $this->checkPHPExtension( 'exif' );
12 
13  $this->setMwGlobals( 'wgShowEXIF', true );
14 
15  $this->filePath = __DIR__ . '/../../data/media/';
16  $this->handler = new TiffHandler;
17  }
18 
22  public function testInvalidFile() {
23  $res = $this->handler->getMetadata( null, $this->filePath . 'README' );
24  $this->assertEquals( ExifBitmapHandler::BROKEN_FILE, $res );
25  }
26 
30  public function testTiffMetadataExtraction() {
31  $res = $this->handler->getMetadata( null, $this->filePath . 'test.tiff' );
32  $expected = 'a:16:{s:10:"ImageWidth";i:20;s:11:"ImageLength";i:20;s:13:"BitsPerSample";a:3:{i:0;i:8;i:1;i:8;i:2;i:8;}s:11:"Compression";i:5;s:25:"PhotometricInterpretation";i:2;s:16:"ImageDescription";s:17:"Created with GIMP";s:12:"StripOffsets";i:8;s:11:"Orientation";i:1;s:15:"SamplesPerPixel";i:3;s:12:"RowsPerStrip";i:64;s:15:"StripByteCounts";i:238;s:11:"XResolution";s:19:"1207959552/16777216";s:11:"YResolution";s:19:"1207959552/16777216";s:19:"PlanarConfiguration";i:1;s:14:"ResolutionUnit";i:2;s:22:"MEDIAWIKI_EXIF_VERSION";i:2;}';
33  // Re-unserialize in case there are subtle differences between how versions
34  // of php serialize stuff.
35  $this->assertEquals( unserialize( $expected ), unserialize( $res ) );
36  }
37 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
TiffTest
Definition: TiffTest.php:2
TiffTest\$filePath
string $filePath
Definition: TiffTest.php:5
TiffTest\testInvalidFile
testInvalidFile()
@covers TiffHandler::getMetadata
Definition: TiffTest.php:20
TiffHandler
Handler for Tiff images.
Definition: Tiff.php:29
MediaWikiTestCase\setMwGlobals
setMwGlobals( $pairs, $value=null)
Definition: MediaWikiTestCase.php:302
MediaWikiTestCase
Definition: MediaWikiTestCase.php:6
TiffTest\setUp
setUp()
Definition: TiffTest.php:7
TiffTest\$handler
TiffHandler $handler
Definition: TiffTest.php:4
MediaWikiTestCase\checkPHPExtension
checkPHPExtension( $extName)
Check if $extName is a loaded PHP extension, will skip the test whenever it is not loaded.
Definition: MediaWikiTestCase.php:1005
ExifBitmapHandler\BROKEN_FILE
const BROKEN_FILE
Definition: ExifBitmap.php:31
TiffTest\testTiffMetadataExtraction
testTiffMetadataExtraction()
@covers TiffHandler::getMetadata
Definition: TiffTest.php:28
$res
$res
Definition: database.txt:21