/** * test uploading a 100 bytes file with $wgMaxUploadSize = 100 * * This method should be abstracted so we can test different settings. */ public function testMaxUploadSize() { global $wgMaxUploadSize; $savedGlobal = $wgMaxUploadSize; // save global global $wgFileExtensions; $wgFileExtensions[] = 'txt'; $wgMaxUploadSize = 100; $filename = $this->createFileOfSize($wgMaxUploadSize); $this->upload->initializePathInfo(basename($filename) . '.txt', $filename, 100); $result = $this->upload->verifyUpload(); unlink($filename); $this->assertEquals(array('status' => UploadBase::OK), $result); $wgMaxUploadSize = $savedGlobal; // restore global }
/** * @dataProvider provideCheckSvgScriptCallback */ public function testCheckSvgScriptCallback($svg, $wellFormed, $filterMatch, $message) { list($formed, $match) = $this->upload->checkSvgString($svg); $this->assertSame($wellFormed, $formed, $message); $this->assertSame($filterMatch, $match, $message); }
/** * @dataProvider provideDetectScriptInSvg */ public function testDetectScriptInSvg($svg, $expected, $message) { // This only checks some weird cases, most tests are in testCheckSvgScriptCallback() above $result = $this->upload->detectScriptInSvg($svg, false); $this->assertSame($expected, $result, $message); }