MediaWiki  REL1_23
SVGTest.php
Go to the documentation of this file.
00001 <?php
00002 
00003 class SvgTest extends MediaWikiTestCase {
00004 
00005     protected function setUp() {
00006         parent::setUp();
00007 
00008         $this->filePath = __DIR__ . '/../../data/media/';
00009 
00010         $this->setMwGlobals( 'wgShowEXIF', true );
00011 
00012         $this->backend = new FSFileBackend( array(
00013             'name' => 'localtesting',
00014             'wikiId' => wfWikiId(),
00015             'containerPaths' => array( 'data' => $this->filePath )
00016         ) );
00017         $this->repo = new FSRepo( array(
00018             'name' => 'temp',
00019             'url' => 'http://localhost/thumbtest',
00020             'backend' => $this->backend
00021         ) );
00022 
00023         $this->handler = new SvgHandler;
00024     }
00025 
00032     public function testGetIndependentMetaArray( $filename, $expected ) {
00033         $file = $this->dataFile( $filename, 'image/svg+xml' );
00034         $res = $this->handler->getCommonMetaArray( $file );
00035 
00036         $this->assertEquals( $res, $expected );
00037     }
00038 
00039     public function providerGetIndependentMetaArray() {
00040         return array(
00041             array( 'Tux.svg', array(
00042                 'ObjectName' => 'Tux',
00043                 'ImageDescription' => 'For more information see: http://commons.wikimedia.org/wiki/Image:Tux.svg',
00044             ) ),
00045             array( 'Wikimedia-logo.svg', array() )
00046         );
00047     }
00048 
00049     private function dataFile( $name, $type ) {
00050         return new UnregisteredLocalFile( false, $this->repo,
00051             "mwstore://localtesting/data/$name", $type );
00052     }
00053 }