Merge "Avoiding implicit transactions when applying"
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiUploadTest.php
index 2548273..b089894 100644 (file)
@@ -31,7 +31,7 @@ class ApiUploadTest extends ApiTestCaseUpload {
         * Testing login
         * XXX this is a funny way of getting session context
         */
-       function testLogin() {
+       public function testLogin() {
                $user = self::$users['uploader'];
 
                $params = array(
@@ -95,7 +95,6 @@ class ApiUploadTest extends ApiTestCaseUpload {
                $this->assertTrue( $exception, "Got exception" );
        }
 
-
        /**
         * @depends testLogin
         */
@@ -138,7 +137,7 @@ class ApiUploadTest extends ApiTestCaseUpload {
                }
                $this->assertTrue( isset( $result['upload'] ) );
                $this->assertEquals( 'Success', $result['upload']['result'] );
-               $this->assertEquals( $fileSize, ( int )$result['upload']['imageinfo']['size'] );
+               $this->assertEquals( $fileSize, (int)$result['upload']['imageinfo']['size'] );
                $this->assertEquals( $mimeType, $result['upload']['imageinfo']['mime'] );
                $this->assertFalse( $exception );
 
@@ -147,7 +146,6 @@ class ApiUploadTest extends ApiTestCaseUpload {
                unlink( $filePath );
        }
 
-
        /**
         * @depends testLogin
         */
@@ -185,7 +183,6 @@ class ApiUploadTest extends ApiTestCaseUpload {
                unlink( $filePath );
        }
 
-
        /**
         * @depends testLogin
         */
@@ -257,7 +254,6 @@ class ApiUploadTest extends ApiTestCaseUpload {
                unlink( $filePaths[1] );
        }
 
-
        /**
         * @depends testLogin
         */
@@ -386,7 +382,7 @@ class ApiUploadTest extends ApiTestCaseUpload {
                $this->assertFalse( $exception );
                $this->assertTrue( isset( $result['upload'] ) );
                $this->assertEquals( 'Success', $result['upload']['result'] );
-               $this->assertEquals( $fileSize, ( int )$result['upload']['imageinfo']['size'] );
+               $this->assertEquals( $fileSize, (int)$result['upload']['imageinfo']['size'] );
                $this->assertEquals( $mimeType, $result['upload']['imageinfo']['mime'] );
                $this->assertTrue( isset( $result['upload']['filekey'] ) );
                $this->assertEquals( $result['upload']['sessionkey'], $result['upload']['filekey'] );
@@ -450,7 +446,7 @@ class ApiUploadTest extends ApiTestCaseUpload {
                $this->deleteFileByFileName( $fileName );
                $this->deleteFileByContent( $filePath );
 
-               // Base upload params: 
+               // Base upload params:
                $params = array(
                        'action' => 'upload',
                        'stash' => 1,
@@ -462,7 +458,7 @@ class ApiUploadTest extends ApiTestCaseUpload {
                // Upload chunks
                $chunkSessionKey = false;
                $resultOffset = 0;
-               // Open the file: 
+               // Open the file:
                $handle = @fopen( $filePath, "r" );
                if ( $handle === false ) {
                        $this->markTestIncomplete( "could not open file: $filePath" );
@@ -483,10 +479,10 @@ class ApiUploadTest extends ApiTestCaseUpload {
                                } catch ( UsageException $e ) {
                                        $this->markTestIncomplete( $e->getMessage() );
                                }
-                               // Make sure we got a valid chunk continue: 
+                               // Make sure we got a valid chunk continue:
                                $this->assertTrue( isset( $result['upload'] ) );
                                $this->assertTrue( isset( $result['upload']['filekey'] ) );
-                               // If we don't get a session key mark test incomplete. 
+                               // If we don't get a session key mark test incomplete.
                                if ( !isset( $result['upload']['filekey'] ) ) {
                                        $this->markTestIncomplete( "no filekey provided" );
                                }
@@ -510,11 +506,11 @@ class ApiUploadTest extends ApiTestCaseUpload {
                        } catch ( UsageException $e ) {
                                $this->markTestIncomplete( $e->getMessage() );
                        }
-                       // Make sure we got a valid chunk continue: 
+                       // Make sure we got a valid chunk continue:
                        $this->assertTrue( isset( $result['upload'] ) );
                        $this->assertTrue( isset( $result['upload']['filekey'] ) );
 
-                       // Check if we were on the last chunk: 
+                       // Check if we were on the last chunk:
                        if ( $params['offset'] + $chunkSize >= $fileSize ) {
                                $this->assertEquals( 'Success', $result['upload']['result'] );
                                break;
@@ -555,7 +551,7 @@ class ApiUploadTest extends ApiTestCaseUpload {
 
                // clean up
                $this->deleteFileByFilename( $fileName );
-               // don't remove downloaded temporary file for fast subquent tests. 
+               // don't remove downloaded temporary file for fast subquent tests.
                //unlink( $filePath );
        }
 }