Revert "merged master"
[lhc/web/wiklou.git] / tests / phpunit / includes / media / FormatMetadataTest.php
index 276c000..8a632f5 100644 (file)
@@ -4,6 +4,17 @@ class FormatMetadataTest extends MediaWikiTestCase {
                if ( !wfDl( 'exif' ) ) {
                        $this->markTestSkipped( "This test needs the exif extension." );
                }
+               $filePath = dirname( __FILE__ ) .  '/../../data/media';
+               $this->backend = new FSFileBackend( array(
+                       'name'           => 'localtesting',
+                       'lockManager'    => 'nullLockManager',
+                       'containerPaths' => array( 'data' => $filePath )
+               ) );
+               $this->repo = new FSRepo( array(
+                       'name'    => 'temp',
+                       'url'     => 'http://localhost/thumbtest',
+                       'backend' => $this->backend
+               ) );
                global $wgShowEXIF;
                $this->show = $wgShowEXIF;
                $wgShowEXIF = true;
@@ -14,8 +25,7 @@ class FormatMetadataTest extends MediaWikiTestCase {
        }
 
        public function testInvalidDate() {
-               $file = UnregisteredLocalFile::newFromPath( dirname( __FILE__ ) . 
-                       '/../../data/media/broken_exif_date.jpg', 'image/jpeg' );
+               $file = $this->dataFile( 'broken_exif_date.jpg', 'image/jpeg' );
                
                // Throws an error if bug hit
                $meta = $file->formatMetadata();
@@ -34,4 +44,9 @@ class FormatMetadataTest extends MediaWikiTestCase {
                        $meta['visible'][$dateIndex]['value'],
                        'File with invalid date metadata (bug 29471)' );
        }
+
+       private function dataFile( $name, $type ) {
+               return new UnregisteredLocalFile( false, $this->repo,
+                       "mwstore://localtesting/data/$name", $type );
+       }
 }