diff options
author | Marc Alexander <admin@m-a-styles.de> | 2015-07-16 00:21:23 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2015-09-09 08:28:05 +0200 |
commit | 845233fc626b0d5e6d9e61039fde8e31b4dd28aa (patch) | |
tree | b035bcba8d133e726914a30a37854c2bfff4852a /tests/files/upload_test.php | |
parent | a09c6d1fb760151b1a6c654b597b4578c3136be1 (diff) | |
download | forums-845233fc626b0d5e6d9e61039fde8e31b4dd28aa.tar forums-845233fc626b0d5e6d9e61039fde8e31b4dd28aa.tar.gz forums-845233fc626b0d5e6d9e61039fde8e31b4dd28aa.tar.bz2 forums-845233fc626b0d5e6d9e61039fde8e31b4dd28aa.tar.xz forums-845233fc626b0d5e6d9e61039fde8e31b4dd28aa.zip |
[ticket/13904] Improve test coverage and use constants instead of magic numbers
PHPBB3-13904
Diffstat (limited to 'tests/files/upload_test.php')
-rw-r--r-- | tests/files/upload_test.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/files/upload_test.php b/tests/files/upload_test.php index 4323f6cc92..057bb8a4f2 100644 --- a/tests/files/upload_test.php +++ b/tests/files/upload_test.php @@ -93,4 +93,27 @@ class phpbb_files_upload_test extends phpbb_test_case $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); $this->assertFalse($upload->is_valid('foobar')); } + + public function data_internal_error() + { + return array( + array(UPLOAD_ERR_INI_SIZE, 'PHP_SIZE_OVERRUN'), + array(UPLOAD_ERR_FORM_SIZE, 'WRONG_FILESIZE'), + array(UPLOAD_ERR_PARTIAL, 'PARTIAL_UPLOAD'), + array(UPLOAD_ERR_NO_FILE, 'NOT_UPLOADED'), + array(UPLOAD_ERR_NO_TMP_DIR, 'Temporary folder could not be found. Please check your PHP installation.'), + array(UPLOAD_ERR_CANT_WRITE, 'Can’t write to temporary folder.'), + array(UPLOAD_ERR_EXTENSION, 'A PHP extension has stopped the file upload.'), + array(9, false), + ); + } + + /** + * @dataProvider data_internal_error + */ + public function test_assign_internal_error($error_code, $expected) + { + $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->request, $this->phpbb_root_path); + $this->assertSame($expected, $upload->assign_internal_error($error_code)); + } } |