Paladox has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/247292

Change subject: Fix tests in TimedMediaHandler
......................................................................

Fix tests in TimedMediaHandler

This adds two missing tests to the required list in TimedMediaHandler, It
adds ApiTestCaseVideoUpload.php and TestWebMHandler.php.

Also fix class in TestWebMHandler.php which had class TestOggHandler which
was used by another file in TimedMediaHandler so it would fail the jenkins
tests so changed the class to TestWebMHandler which now passes jenkins.

Also update the test to support some recent changes done to
TimedMediaHandler.

Change-Id: Ibe4a423e0bcb1f2a416707609fa42b41d8f90b83
---
M TimedMediaHandler.hooks.php
M tests/phpunit/ApiTestCaseVideoUpload.php
M tests/phpunit/TestWebMHandler.php
3 files changed, 12 insertions(+), 11 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/92/247292/1

diff --git a/TimedMediaHandler.hooks.php b/TimedMediaHandler.hooks.php
index 6acfe41..cbd3693 100644
--- a/TimedMediaHandler.hooks.php
+++ b/TimedMediaHandler.hooks.php
@@ -399,10 +399,12 @@
                $testDir = __DIR__ . '/tests/phpunit/';
                $testFiles = array(
                        'TestTimeParsing.php',
+                       'ApiTestCaseVideoUpload.php',
                        'TestApiUploadVideo.php',
                        'TestVideoThumbnail.php',
                        'TestVideoTranscode.php',
                        'TestOggHandler.php',
+                       'TestWebMHandler.php',
                        'TestTimedMediaTransformOutput.php',
                        'TestTimedMediaHandler.php'
                );
diff --git a/tests/phpunit/ApiTestCaseVideoUpload.php 
b/tests/phpunit/ApiTestCaseVideoUpload.php
index 9dd4cb5..a25bd3a 100644
--- a/tests/phpunit/ApiTestCaseVideoUpload.php
+++ b/tests/phpunit/ApiTestCaseVideoUpload.php
@@ -10,13 +10,13 @@
 
 // Include core class ApiTestCaseUpload ( not part of base autoLoader )
 global $IP;
-require_once( "$IP/tests/phpunit/includes/api/ApiTestCaseUpload.php" );
+require_once ( "$IP/tests/phpunit/includes/api/ApiTestCaseUpload.php" );
 
 abstract class ApiTestCaseVideoUpload extends ApiTestCaseUpload {
        /**
         * @return Array set of test files with associated metadata
         */
-       static function mediaFilesProvider(){
+       static function mediaFilesProvider() {
                return array(
                        array(
                                // Double wrap the file array to match phpunit 
data provider conventions
@@ -54,7 +54,7 @@
                parent::tearDown();
 
                $testMediaFiles = $this->mediaFilesProvider();
-               foreach( $testMediaFiles as $file ){
+               foreach ( $testMediaFiles as $file ) {
                        $file = $file[0];
                        // Clean up and delete all files
                        $this->deleteFileByFilename( $file['filePath'] );
@@ -88,7 +88,7 @@
        /**
         * uploads a file:
         */
-       public function uploadFile( $file ){
+       public function uploadFile( $file ) {
                global $wgUser;
                // get a session object
                $session = $this->doLogin();
@@ -116,15 +116,14 @@
                        'ignorewarnings' => true
                );
 
-               try{
+               try {
                        list( $result, , ) = $this->doApiRequestWithToken( 
$params, $session );
-               } catch( Exception $e ) {
+               } catch ( Exception $e ) {
                        // Could not upload mark test that called uploadFile as 
incomplete
                        $this->markTestIncomplete( $e->getMessage() );
                }
 
                return $result;
-
        }
 
 }
diff --git a/tests/phpunit/TestWebMHandler.php 
b/tests/phpunit/TestWebMHandler.php
index 2d73f46..a7989e8 100644
--- a/tests/phpunit/TestWebMHandler.php
+++ b/tests/phpunit/TestWebMHandler.php
@@ -1,5 +1,6 @@
 <?php
-class TestOggHandler extends MediaWikiMediaTestCase {
+
+class TestWebMHandler extends MediaWikiMediaTestCase {
 
        /** @var OggHandlerTMH */
        private $handler;
@@ -27,10 +28,9 @@
                return array(
                        array( 'shuttle10seconds.1080x608.webm', array( 'VP8' ) 
),
                        array( 'VP9-tractor.webm', array( 'VP9' ) ),
-                       array( 'bear-vp9-opus.webm', array( 'Opus', 'VP9' ) )
+                       array( 'bear-vp9-opus.webm', array( 'VP9', 'Opus' ) )
                );
        }
-
 
        /**
         * @dataProvider providerGetWebType
@@ -46,7 +46,7 @@
                return array(
                        array( 'shuttle10seconds.1080x608.webm', 'video/webm; 
codecs="vp8"' ),
                        array( 'VP9-tractor.webm', 'video/webm; codecs="vp9"' ),
-                       array( 'bear-vp9-opus.webm', 'video/webm; codecs="opus, 
vp9"' )
+                       array( 'bear-vp9-opus.webm', 'video/webm; codecs="vp9, 
opus"' )
                );
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/247292
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe4a423e0bcb1f2a416707609fa42b41d8f90b83
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to