Merge "Detect user rights conflicts"
[lhc/web/wiklou.git] / tests / phpunit / includes / media / FormatMetadataTest.php
index 6ade670..f26d27e 100644 (file)
@@ -1,36 +1,34 @@
 <?php
 class FormatMetadataTest extends MediaWikiTestCase {
-       public function setUp() {
+
+       protected function setUp() {
+               parent::setUp();
+
                if ( !wfDl( 'exif' ) ) {
                        $this->markTestSkipped( "This test needs the exif extension." );
                }
-               $filePath = __DIR__ .  '/../../data/media';
+               $filePath = __DIR__ . '/../../data/media';
                $this->backend = new FSFileBackend( array(
-                       'name'           => 'localtesting',
-                       'lockManager'    => 'nullLockManager',
+                       'name' => 'localtesting',
+                       'lockManager' => 'nullLockManager',
                        'containerPaths' => array( 'data' => $filePath )
                ) );
                $this->repo = new FSRepo( array(
-                       'name'    => 'temp',
-                       'url'     => 'http://localhost/thumbtest',
+                       'name' => 'temp',
+                       'url' => 'http://localhost/thumbtest',
                        'backend' => $this->backend
                ) );
-               global $wgShowEXIF;
-               $this->show = $wgShowEXIF;
-               $wgShowEXIF = true;
-       }
-       public function tearDown() {
-               global $wgShowEXIF;
-               $wgShowEXIF = $this->show;
+
+               $this->setMwGlobals( 'wgShowEXIF', true );
        }
 
        public function testInvalidDate() {
                $file = $this->dataFile( 'broken_exif_date.jpg', 'image/jpeg' );
-               
+
                // Throws an error if bug hit
                $meta = $file->formatMetadata();
                $this->assertNotEquals( false, $meta, 'Valid metadata extracted' );
-               
+
                // Find date exif entry
                $this->assertArrayHasKey( 'visible', $meta );
                $dateIndex = null;
@@ -40,7 +38,7 @@ class FormatMetadataTest extends MediaWikiTestCase {
                        }
                }
                $this->assertNotNull( $dateIndex, 'Date entry exists in metadata' );
-               $this->assertEquals( '0000:01:00 00:02:27', 
+               $this->assertEquals( '0000:01:00 00:02:27',
                        $meta['visible'][$dateIndex]['value'],
                        'File with invalid date metadata (bug 29471)' );
        }