Add test case for Opus file check
authorBrion Vibber <brion@pobox.com>
Tue, 17 Jan 2017 21:23:02 +0000 (13:23 -0800)
committerBrion Vibber <brion@pobox.com>
Tue, 17 Jan 2017 21:24:16 +0000 (13:24 -0800)
Test case for Opus file check so we don't regress!
Confirms the fix for T151352 that Opus files return
type 'audio' and not 'multimedia'.

Bug: T151352
Change-Id: Ib868793d90b60609ccec25726e6fbaa28bffebaf

tests/phpunit/data/media/say-test.opus [new file with mode: 0644]
tests/phpunit/includes/libs/mime/MimeAnalyzerTest.php

diff --git a/tests/phpunit/data/media/say-test.opus b/tests/phpunit/data/media/say-test.opus
new file mode 100644 (file)
index 0000000..168d218
Binary files /dev/null and b/tests/phpunit/data/media/say-test.opus differ
index 85927a3..53a36c5 100644 (file)
@@ -59,4 +59,14 @@ class MimeMagicTest extends PHPUnit_Framework_TestCase {
                $actualType = $this->mimeAnalyzer->getMediaType( $oggFile, 'application/ogg' );
                $this->assertEquals( $actualType, MEDIATYPE_AUDIO );
        }
+
+       /**
+        * Test to make sure that Opus audio files don't trigger
+        * MEDIATYPE_MULTIMEDIA (bug T151352)
+        */
+       function testOpusRecognize() {
+               $oggFile = __DIR__ . '/../../../data/media/say-test.opus';
+               $actualType = $this->mimeAnalyzer->getMediaType( $oggFile, 'application/ogg' );
+               $this->assertEquals( $actualType, MEDIATYPE_AUDIO );
+       }
 }