diff options
Diffstat (limited to 'tests/php/phpt')
-rw-r--r-- | tests/php/phpt/variables/023-cookie.phpt | 16 | ||||
-rw-r--r-- | tests/php/phpt/variables/024-get-post.phpt | 26 | ||||
-rw-r--r-- | tests/php/phpt/variables/025-post-raw1.phpt | 27 | ||||
-rw-r--r-- | tests/php/phpt/variables/026-post-raw2.phpt | 38 | ||||
-rw-r--r-- | tests/php/phpt/variables/027-env.phpt | 25 |
5 files changed, 132 insertions, 0 deletions
diff --git a/tests/php/phpt/variables/023-cookie.phpt b/tests/php/phpt/variables/023-cookie.phpt new file mode 100644 index 0000000..0648188 --- /dev/null +++ b/tests/php/phpt/variables/023-cookie.phpt @@ -0,0 +1,16 @@ +--TEST-- +test cookie +--SKIPIF-- +<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> +--COOKIE-- +peace=toTheWorld;freedom=toThePeople +--FILEEOF-- +<?php + + +TestVariables\getCookie(); + +--EXPECT-- +_COOKIE[peace] = toTheWorld +_COOKIE[freedom] = toThePeople +_COOKIE[empty] =
\ No newline at end of file diff --git a/tests/php/phpt/variables/024-get-post.phpt b/tests/php/phpt/variables/024-get-post.phpt new file mode 100644 index 0000000..9ac1243 --- /dev/null +++ b/tests/php/phpt/variables/024-get-post.phpt @@ -0,0 +1,26 @@ +--TEST-- +test get and post +--SKIPIF-- +<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> +--GET-- +a=<b>test</b>&b=http://phpcpp.com&ar[elm1]=1234&ar[elm2]=0660&a=0234 +--POST-- +c=<p>string</p>&d=12345.7&e[]=e1&e[]=e2 +--FILEEOF-- +<?php + + +TestVariables\get_post(); + +--EXPECTF-- +_GET[a] = 0234 +_GET[b] = http://phpcpp.com +_GET[ar][elm1] = 1234 +_GET[ar][elm2] = 0660 +_POST[c] = <p>string</p> +_POST[d] = 12345.7 + +Notice: Array to string conversion in %s/024-get-post.php on line %d +_POST[e] = Array +_POST[e][0] = e1 +_POST[e][1] = e2
\ No newline at end of file diff --git a/tests/php/phpt/variables/025-post-raw1.phpt b/tests/php/phpt/variables/025-post-raw1.phpt new file mode 100644 index 0000000..76fed0f --- /dev/null +++ b/tests/php/phpt/variables/025-post-raw1.phpt @@ -0,0 +1,27 @@ +--TEST-- +test post raw #1 +--SKIPIF-- +<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> +--POST_RAW-- +Content-type: multipart/form-data, boundary=AaB03x + +--AaB03x +content-disposition: form-data; name="username" + +valmat +--AaB03x +content-disposition: form-data; name="text" + +Hellow World! +--AaB03x +--FILEEOF-- +<?php + + +TestVariables\post_raw1(); + +//foreach($_POST as $k => $v) {echo "\n$k => $v";} + +--EXPECTF-- +username => valmat +text => Hellow World!
\ No newline at end of file diff --git a/tests/php/phpt/variables/026-post-raw2.phpt b/tests/php/phpt/variables/026-post-raw2.phpt new file mode 100644 index 0000000..4bee44c --- /dev/null +++ b/tests/php/phpt/variables/026-post-raw2.phpt @@ -0,0 +1,38 @@ +--TEST-- +Post files +--DESCRIPTION-- +Simulates the file upload method post +test post raw #2 +--SKIPIF-- +<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> +--POST_RAW-- +Content-type: multipart/form-data, boundary=AaB03x + +--AaB03x +content-disposition: form-data; name="flnm[]"; filename="file1.txt" +Content-Type: text/plain + +abcdef123456789 +--AaB03x +content-disposition: form-data; name="flnm[]"; filename="file2.txt" +Content-Type: text/plain + +«£¥§©®°±¶Я⅓⅘⅞Ⅻↆ❄❅❆⚑⚐⌛⌚〰» +--AaB03x +--FILEEOF-- +<?php + + +TestVariables\post_raw2(); + +--EXPECTF-- +name1 : file1.txt +name2 : file2.txt +type1 : text/plain +type2 : text/plain +error1 : 0 +error2 : 0 +size1 : 15 +size2 : 61 +content1 : abcdef123456789 +content2 : «£¥§©®°±¶Я⅓⅘⅞Ⅻↆ❄❅❆⚑⚐⌛⌚〰»
\ No newline at end of file diff --git a/tests/php/phpt/variables/027-env.phpt b/tests/php/phpt/variables/027-env.phpt new file mode 100644 index 0000000..4e84cfe --- /dev/null +++ b/tests/php/phpt/variables/027-env.phpt @@ -0,0 +1,25 @@ +--TEST-- +test superglobal _ENV +--SKIPIF-- +<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> +--ENV-- +return <<<END +ENVVAR1=ENVVAL1 +HTTP_REFERER=http://spb.1gs.ru/ +HTTP_USER_AGENT=Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0 +HTTP_COOKIE=usr=1cfa6e9905; pc=0; PHPSESSID=4d08j9phpe1c6; vmode=0 +HTTP_HOST=phpcpp.com +END; +--FILEEOF-- +<?php + + +TestVariables\test_env(); +//var_export($_SERVER); echo PHP_EOL, PHP_EOL, PHP_EOL; + +--EXPECTF-- +HTTP_USER_AGENT => Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0 +ENVVAR1 => ENVVAL1 +HTTP_REFERER => http://spb.1gs.ru/ +REQUEST_METHOD => GET +HTTP_HOST => phpcpp.com |