aboutsummaryrefslogtreecommitdiffstats
path: root/tests/request/request_test.php
diff options
context:
space:
mode:
authorNathaniel Guse <nathaniel.guse@gmail.com>2012-11-11 04:42:06 -0600
committerNathaniel Guse <nathaniel.guse@gmail.com>2012-11-11 04:42:06 -0600
commit84ba10ec8c023ab307eb7d0b829ab337aaaae78e (patch)
tree468abf9fbb513cba53803ca29c6b65fd4ea497ec /tests/request/request_test.php
parent106daa09ebb5b12bf9892c41f8c1de627cf6b0e9 (diff)
parente86ecc0f3bd6383d31a670896720a970b8faaaa9 (diff)
downloadforums-84ba10ec8c023ab307eb7d0b829ab337aaaae78e.tar
forums-84ba10ec8c023ab307eb7d0b829ab337aaaae78e.tar.gz
forums-84ba10ec8c023ab307eb7d0b829ab337aaaae78e.tar.bz2
forums-84ba10ec8c023ab307eb7d0b829ab337aaaae78e.tar.xz
forums-84ba10ec8c023ab307eb7d0b829ab337aaaae78e.zip
Merge branch 'develop' of github.com:EXreaction/phpbb3 into ticket/11103
Diffstat (limited to 'tests/request/request_test.php')
-rw-r--r--tests/request/request_test.php25
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.