~ubuntu-branches/ubuntu/trusty/mediawiki/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/phpunit/includes/GlobalFunctions/wfShorthandToIntegerTest.php

  • Committer: Package Import Robot
  • Author(s): Thorsten Glaser
  • Date: 2014-03-28 09:56:29 UTC
  • mfrom: (1.3.14)
  • Revision ID: package-import@ubuntu.com-20140328095629-1526y9tchdd507id
Tags: 1:1.19.14+dfsg-1
* New upstream security fix release (Closes: #742857):
  - (bug 62497) SECURITY: Add CSRF token on Special:ChangePassword
  - (bug 62467) Set a title for the context during import on the cli
* Use upstream-provided signing key bundle

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
class wfShorthandToIntegerTest extends MediaWikiTestCase {
 
4
        /**
 
5
         * @dataProvider provideABunchOfShorthands
 
6
         */
 
7
        function testWfShorthandToInteger( $input, $output, $description ) {
 
8
                $this->assertEquals(
 
9
                        wfShorthandToInteger( $input ),
 
10
                        $output,
 
11
                        $description
 
12
                );
 
13
        }
 
14
 
 
15
        function provideABunchOfShorthands() {
 
16
                return array(
 
17
                        array( '', -1, 'Empty string' ),
 
18
                        array( '     ', -1, 'String of spaces' ),
 
19
                        array( '1G', 1024 * 1024 * 1024, 'One gig uppercased' ),
 
20
                        array( '1g', 1024 * 1024 * 1024, 'One gig lowercased' ),
 
21
                        array( '1M', 1024 * 1024, 'One meg uppercased' ),
 
22
                        array( '1m', 1024 * 1024, 'One meg lowercased' ),
 
23
                        array( '1K', 1024, 'One kb uppercased' ),
 
24
                        array( '1k', 1024, 'One kb lowercased' ),
 
25
                );
 
26
        }
 
27
        
 
28
}