Index: trunk/phase3/maintenance/tests/UploadTest.php |
— | — | @@ -4,47 +4,47 @@ |
5 | 5 | */ |
6 | 6 | class UploadTest extends PHPUnit_Framework_TestCase { |
7 | 7 | protected $upload; |
8 | | - |
9 | 8 | |
| 9 | + |
10 | 10 | function setUp() { |
11 | 11 | parent::setup(); |
12 | | - $this->upload = new UploadTestHandler; |
| 12 | + $this->upload = new UploadTestHandler; |
13 | 13 | } |
14 | | - |
| 14 | + |
15 | 15 | /** |
16 | 16 | * Test various forms of valid and invalid titles that can be supplied. |
17 | 17 | */ |
18 | 18 | public function testTitleValidation() { |
19 | 19 | |
20 | | - |
| 20 | + |
21 | 21 | /* Test a valid title */ |
22 | | - $this->assertUploadTitleAndCode( 'ValidTitle.jpg', |
| 22 | + $this->assertUploadTitleAndCode( 'ValidTitle.jpg', |
23 | 23 | 'ValidTitle.jpg', UploadTestHandler::OK, |
24 | 24 | 'upload valid title' ); |
25 | | - |
| 25 | + |
26 | 26 | /* A title with a slash */ |
27 | 27 | $this->assertUploadTitleAndCode( 'A/B.jpg', |
28 | 28 | 'B.jpg', UploadTestHandler::OK, |
29 | 29 | 'upload title with slash' ); |
30 | | - |
| 30 | + |
31 | 31 | /* A title with illegal char */ |
32 | 32 | $this->assertUploadTitleAndCode( 'A:B.jpg', |
33 | 33 | 'A-B.jpg', UploadTestHandler::OK, |
34 | 34 | 'upload title with colon' ); |
35 | | - |
| 35 | + |
36 | 36 | /* A title without extension */ |
37 | 37 | $this->assertUploadTitleAndCode( 'A', |
38 | 38 | null, UploadTestHandler::FILETYPE_MISSING, |
39 | 39 | 'upload title without extension' ); |
40 | | - |
| 40 | + |
41 | 41 | /* A title with no basename */ |
42 | 42 | $this->assertUploadTitleAndCode( '.jpg', |
43 | 43 | null, UploadTestHandler::MIN_LENGTH_PARTNAME, |
44 | 44 | 'upload title without basename' ); |
45 | | - |
| 45 | + |
46 | 46 | } |
47 | 47 | /** |
48 | | - * Helper function for testTitleValidation. First checks the return code |
| 48 | + * Helper function for testTitleValidation. First checks the return code |
49 | 49 | * of UploadBase::getTitle() and then the actual returned titl |
50 | 50 | */ |
51 | 51 | private function assertUploadTitleAndCode( $srcFilename, $dstFilename, $code, $msg ) { |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | $this->assertEquals( $code, |
54 | 54 | $this->upload->testTitleValidation( $srcFilename ), |
55 | 55 | "$msg code" ); |
56 | | - |
| 56 | + |
57 | 57 | /* If we expect a valid title, check the title itself. */ |
58 | 58 | if ( $code == UploadTestHandler::OK ) { |
59 | 59 | $this->assertEquals( $dstFilename, |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | "$msg text" ); |
62 | 62 | } |
63 | 63 | } |
64 | | - |
| 64 | + |
65 | 65 | /** |
66 | 66 | * Test the upload verification functions |
67 | 67 | */ |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | $this->upload->initializePathInfo( '', '', 0 ); |
71 | 71 | $result = $this->upload->verifyUpload(); |
72 | 72 | $this->assertEquals( UploadTestHandler::EMPTY_FILE, |
73 | | - $result['status'], |
| 73 | + $result['status'], |
74 | 74 | 'upload empty file' ); |
75 | 75 | } |
76 | 76 | |