summaryrefslogtreecommitdiff
path: root/extensions/TimedMediaHandler/tests/phpunit/TestTimedMediaHandler.php
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/TimedMediaHandler/tests/phpunit/TestTimedMediaHandler.php')
-rw-r--r--extensions/TimedMediaHandler/tests/phpunit/TestTimedMediaHandler.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/extensions/TimedMediaHandler/tests/phpunit/TestTimedMediaHandler.php b/extensions/TimedMediaHandler/tests/phpunit/TestTimedMediaHandler.php
new file mode 100644
index 00000000..2ca350a0
--- /dev/null
+++ b/extensions/TimedMediaHandler/tests/phpunit/TestTimedMediaHandler.php
@@ -0,0 +1,47 @@
+<?php
+class TestTimedMediaHandler extends MediaWikiTestCase {
+
+ /** @var TimedMediaHandler */
+ private $handler;
+
+ function setUp() {
+ $this->handler = new TimedMediaHandler;
+ parent::setUp();
+ }
+
+ /**
+ * @dataProvider providerParseParamString
+ * @param $str String a thumbnail parameter string
+ * @param $expected Array Expected thumbnailing parameters
+ */
+ function testParseParamString( $str, $expected ) {
+ $result = $this->handler->parseParamString( $str );
+ $this->assertEquals( $result, $expected );
+ }
+
+ function providerParseParamString() {
+ return array(
+ array(
+ 'mid',
+ array(),
+ ),
+ array(
+ '220px-',
+ array( 'width' => 220 ),
+ ),
+ array(
+ 'seek=30',
+ array( 'thumbtime' => 30.0 ),
+ ),
+ array(
+ 'seek=15.72',
+ array( 'thumbtime' => 15.72 ),
+ ),
+ array(
+ '180px-seek=15',
+ array( 'thumbtime' => 15, 'width' => 180 ),
+ ),
+ );
+
+ }
+}