From a5f917bbc55e295896b8084f6657eb8b6abaf8a8 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Fri, 15 Jul 2016 15:33:36 -0300 Subject: Add TimedMediaHandler extension that allows display audio and video files in wiki pages, using the same syntax as for image files --- .../tests/phpunit/TestOggHandler.php | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 extensions/TimedMediaHandler/tests/phpunit/TestOggHandler.php (limited to 'extensions/TimedMediaHandler/tests/phpunit/TestOggHandler.php') diff --git a/extensions/TimedMediaHandler/tests/phpunit/TestOggHandler.php b/extensions/TimedMediaHandler/tests/phpunit/TestOggHandler.php new file mode 100644 index 00000000..3c058974 --- /dev/null +++ b/extensions/TimedMediaHandler/tests/phpunit/TestOggHandler.php @@ -0,0 +1,67 @@ +handler = new OggHandlerTMH; + } + + /** + * @dataProvider providerGetCommonMetaArray + * @param $filename String name of file + * @param $expected Array + */ + function testGetCommonMetaArray( $filename, $expected ) { + $testFile = $this->dataFile( $filename, 'application/ogg' ); + $this->assertEquals( $expected, $this->handler->getCommonMetaArray( $testFile ) ); + } + + function providerGetCommonMetaArray() { + return array( + array( 'test5seconds.electricsheep.300x400.ogv', + array( + 'Software' => array( 'Lavf53.21.1' ), + 'ObjectName' => array( 'Electric Sheep' ), + 'UserComment' => array( '🐑' ) + ) + ), + array( 'doubleTag.oga', + array( + 'Artist' => array( 'Brian', 'Bawolff' ), + 'Software' => array( 'Lavf55.10.2' ) + ) + ), + array( 'broken-file.ogg', + array() + ), + ); + } + + /** + * @dataProvider providerGetWebType + * @param $filename String name of file + * @param $expected String Mime type (including codecs) + */ + function testGetWebType( $filename, $expected ) { + $testFile = $this->dataFile( $filename, 'application/ogg' ); + $this->assertEquals( $expected, $this->handler->getWebType( $testFile ) ); + } + + function providerGetWebType() { + return array( + array( 'test5seconds.electricsheep.300x400.ogv', 'video/ogg; codecs="theora"' ), + array( 'doubleTag.oga', 'audio/ogg; codecs="vorbis"' ), + // XXX: This behaviour is somewhat questionable. It perhaps should be + // application/ogg in this case. + array( 'broken-file.ogg', 'audio/ogg' ), + ); + } + +} -- cgit v1.2.3-54-g00ecf