diff options
author | Andreas Fischer <bantu@phpbb.com> | 2012-07-09 15:10:36 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2012-07-09 15:10:36 +0200 |
commit | 348d9b882955bd32b3db8d9724677b8602d7179d (patch) | |
tree | 4a25509dcb5bc6149b027be8c91dcad4e7fedd02 /tests/mock/fileupload.php | |
parent | 9f0259c473f2108464b63aab62298e5052c0a8a7 (diff) | |
parent | 65d7aae2f306d1fed2f26c97caf8b15d178828ce (diff) | |
download | forums-348d9b882955bd32b3db8d9724677b8602d7179d.tar forums-348d9b882955bd32b3db8d9724677b8602d7179d.tar.gz forums-348d9b882955bd32b3db8d9724677b8602d7179d.tar.bz2 forums-348d9b882955bd32b3db8d9724677b8602d7179d.tar.xz forums-348d9b882955bd32b3db8d9724677b8602d7179d.zip |
Merge remote-tracking branch 'Fyorl/ticket/10941' into develop
* Fyorl/ticket/10941: (30 commits)
[ticket/10941] Removed superfluous array
[ticket/10941] File 'txt' now too big so changed tests to reflect that
[ticket/10941] Added a comment to ensure tags stay uppercase
[ticket/10941] Modified tearDown to use DirectoryIterator instead of glob
[ticket/10941] Added tests/upload/fixture/copies to tracking
[ticket/10941] Fixed form test test_too_large
[ticket/10941] Replaced use of English with language system
[ticket/10941] Renamed classes and filenames so that tests run
[ticket/10941] Moved comment into markTestIncomplete parameter
[ticket/10941] Removed manual includes of mock classes
[ticket/10941] Added subdirectory for file operations
[ticket/10941] Added some comments for clarification
[ticket/10941] Fixed a failing test
[ticket/10941] Rearranged tests into their own classes or methods
[ticket/10941] Removed the incomplete mark as is_image is fixed
[ticket/10941] Refactored tearDown to stop iterating over the directory.
[ticket/10941] Refactored init_filespec to return new object.
[ticket/10941] Minor typo fixes
[ticket/10941] Changed assertTrue to assertEquals
[ticket/10941] Now actually checks for the value of errors.
...
Diffstat (limited to 'tests/mock/fileupload.php')
-rw-r--r-- | tests/mock/fileupload.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/mock/fileupload.php b/tests/mock/fileupload.php new file mode 100644 index 0000000000..409036ba63 --- /dev/null +++ b/tests/mock/fileupload.php @@ -0,0 +1,52 @@ +<?php +/** + * + * @package testing + * @copyright (c) 2012 phpBB Group + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + * + */ + +/** + * Mock fileupload class with some basic values to help with testing the + * filespec class + */ +class phpbb_mock_fileupload +{ + public $max_filesize = 100; + public $error_prefix = ''; + + public function valid_dimensions($filespec) + { + return true; + } + + /** + * Copied verbatim from phpBB/includes/functions_upload.php's fileupload + * class to ensure the correct behaviour of filespec::move_file. + * + * Maps file extensions to the constant in second index of the array + * returned by getimagesize() + */ + public function image_types() + { + return array( + IMAGETYPE_GIF => array('gif'), + IMAGETYPE_JPEG => array('jpg', 'jpeg'), + IMAGETYPE_PNG => array('png'), + IMAGETYPE_SWF => array('swf'), + IMAGETYPE_PSD => array('psd'), + IMAGETYPE_BMP => array('bmp'), + IMAGETYPE_TIFF_II => array('tif', 'tiff'), + IMAGETYPE_TIFF_MM => array('tif', 'tiff'), + IMAGETYPE_JPC => array('jpg', 'jpeg'), + IMAGETYPE_JP2 => array('jpg', 'jpeg'), + IMAGETYPE_JPX => array('jpg', 'jpeg'), + IMAGETYPE_JB2 => array('jpg', 'jpeg'), + IMAGETYPE_SWC => array('swc'), + IMAGETYPE_IFF => array('iff'), + IMAGETYPE_WBMP => array('wbmp'), + IMAGETYPE_XBM => array('xbm'), + ); + } +} |