diff options
| author | Andreas Fischer <bantu@phpbb.com> | 2012-11-10 23:49:29 +0100 |
|---|---|---|
| committer | Andreas Fischer <bantu@phpbb.com> | 2012-11-10 23:49:29 +0100 |
| commit | e86ecc0f3bd6383d31a670896720a970b8faaaa9 (patch) | |
| tree | 0bb5af4cffd3b53f3225ea2c72670e343709d86d /tests/request | |
| parent | 847feb07e784ccbe646257553f1efba8c5032b7f (diff) | |
| parent | 1f9bff2126bbec514c4a7b675723bfe7f26c432e (diff) | |
| download | forums-e86ecc0f3bd6383d31a670896720a970b8faaaa9.tar forums-e86ecc0f3bd6383d31a670896720a970b8faaaa9.tar.gz forums-e86ecc0f3bd6383d31a670896720a970b8faaaa9.tar.bz2 forums-e86ecc0f3bd6383d31a670896720a970b8faaaa9.tar.xz forums-e86ecc0f3bd6383d31a670896720a970b8faaaa9.zip | |
Merge remote-tracking branch 'Fyorl/ticket/10939' into develop
* Fyorl/ticket/10939:
[ticket/10939] Added documentation for phpbb_request::file
[ticket/10939] Added tests for phpbb_request::file
[ticket/10939] Modified the default return for $request->file
[ticket/10939] Modified fileupload tests to deal with new behaviour
[ticket/10939] Modified mock request class to handle deactivated $_FILES
[ticket/10939] Modified acp_groups.php to not use $_FILES
[ticket/10939] Modified ucp_groups.php to not use $_FILES
[ticket/10939] Modified functions_user.php to not use $_FILES
[ticket/10939] Modified message_parser.php to not use $_FILES
[ticket/10939] Modified functions_upload to not use $_FILES
[ticket/10939] Modified request test slightly to include $_FILES
[ticket/10939] Added $_FILES handling to phpbb_request
Diffstat (limited to 'tests/request')
| -rw-r--r-- | tests/request/request_test.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/request/request_test.php b/tests/request/request_test.php index bca5125b7a..52c21abd2a 100644 --- a/tests/request/request_test.php +++ b/tests/request/request_test.php @@ -21,6 +21,13 @@ class phpbb_request_test extends phpbb_test_case $_COOKIE['test'] = 3; $_REQUEST['test'] = 3; $_GET['unset'] = ''; + $_FILES['test'] = array( + 'name' => 'file', + 'tmp_name' => 'tmp', + 'size' => 256, + 'type' => 'application/octet-stream', + 'error' => UPLOAD_ERR_OK, + ); $_SERVER['HTTP_HOST'] = 'example.com'; $_SERVER['HTTP_ACCEPT'] = 'application/json'; @@ -42,6 +49,7 @@ class phpbb_request_test extends phpbb_test_case $this->assertEquals(2, $_GET['test'], 'Checking $_GET after enable_super_globals'); $this->assertEquals(3, $_COOKIE['test'], 'Checking $_COOKIE after enable_super_globals'); $this->assertEquals(3, $_REQUEST['test'], 'Checking $_REQUEST after enable_super_globals'); + $this->assertEquals(256, $_FILES['test']['size']); $_POST['x'] = 2; $this->assertEquals($_POST, $GLOBALS['_POST'], 'Checking whether $_POST can still be accessed via $GLOBALS[\'_POST\']'); @@ -85,6 +93,23 @@ class phpbb_request_test extends phpbb_test_case $this->request->header('SOMEVAR'); } + public function test_file() + { + $file = $this->request->file('test'); + $this->assertEquals('file', $file['name']); + $this->assertEquals('tmp', $file['tmp_name']); + $this->assertEquals(256, $file['size']); + $this->assertEquals('application/octet-stream', $file['type']); + $this->assertEquals(UPLOAD_ERR_OK, $file['error']); + } + + public function test_file_not_exists() + { + $file = $this->request->file('404'); + $this->assertTrue(is_array($file)); + $this->assertTrue(empty($file)); + } + /** * Checks that directly accessing $_POST will trigger * an error. |
