From c1f2ac7da167dec92df81ad33de65b953ccd043d Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 5 Apr 2013 13:04:48 +0000 Subject: [PATCH] client test and fixes --- package.xml | 26 +++++++--- php_http_client.c | 94 ++++++++++++++++++++++++----------- php_http_client.h | 6 ++- php_http_client_curl.c | 3 +- php_http_misc.c | 28 +++++++++++ php_http_misc.h | 2 + tests/client001.phpt | 21 ++++++++ tests/client002.phpt | 37 ++++++++++++++ tests/client003.phpt | 29 +++++++++++ tests/client004.phpt | 35 +++++++++++++ tests/client005.phpt | 27 ++++++++++ tests/client006.phpt | 42 ++++++++++++++++ tests/client007.phpt | 34 +++++++++++++ tests/client008.phpt | 36 ++++++++++++++ tests/client009.phpt | 47 ++++++++++++++++++ tests/client010.phpt | 36 ++++++++++++++ tests/clientresponse001.phpt | 45 +++++++++++++++++ tests/clientresponse002.phpt | 63 +++++++++++++++++++++++ tests/clientresponse003.phpt | 25 ++++++++++ tests/envrequestfiles001.phpt | 2 +- tests/envrequestfiles002.phpt | 2 +- tests/envrequestform.phpt | 2 +- tests/envrequestquery.phpt | 2 +- tests/envresponsecodes.phpt | 2 +- tests/message001.phpt | 2 +- tests/querystring_001.phpt | 2 +- 26 files changed, 602 insertions(+), 48 deletions(-) create mode 100644 tests/client001.phpt create mode 100644 tests/client002.phpt create mode 100644 tests/client003.phpt create mode 100644 tests/client004.phpt create mode 100644 tests/client005.phpt create mode 100644 tests/client006.phpt create mode 100644 tests/client007.phpt create mode 100644 tests/client008.phpt create mode 100644 tests/client009.phpt create mode 100644 tests/client010.phpt create mode 100644 tests/clientresponse001.phpt create mode 100644 tests/clientresponse002.phpt create mode 100644 tests/clientresponse003.phpt diff --git a/package.xml b/package.xml index ca92778..ac62a6a 100644 --- a/package.xml +++ b/package.xml @@ -11,14 +11,16 @@ pecl.php.net Extended HTTP Support errorHandling. -* The request ecosystem has been modularized to support different libraries, though for the moment only libcurl is supported. +It eases handling of HTTP urls, headers and messages, provides +means for negotiation of a client's preferred content type, +language and charset, as well as a convenient way to send any +arbitrary data with caching and resuming capabilities. + +It provides powerful request functionality, if built with CURL +support. Parallel requests are available for PHP 5 and greater. ]]> Michael Wallner @@ -36,7 +38,15 @@ Extended HTTP support. Again. Keep in mind that it's got the major version 2, be beta BSD, revised - errorHandling. +* The request ecosystem has been modularized to support different libraries, though for the moment only libcurl is supported. ]]> diff --git a/php_http_client.c b/php_http_client.c index 0826bbf..f23322d 100644 --- a/php_http_client.c +++ b/php_http_client.c @@ -8,27 +8,40 @@ */ static HashTable php_http_client_drivers; -PHP_HTTP_API STATUS php_http_client_driver_add(const char *name_str, uint name_len, php_http_client_driver_t *driver) +PHP_HTTP_API STATUS php_http_client_driver_add(php_http_client_driver_t *driver) { - return zend_hash_add(&php_http_client_drivers, name_str, name_len + 1, (void *) driver, sizeof(php_http_client_driver_t), NULL); + return zend_hash_add(&php_http_client_drivers, driver->name_str, driver->name_len + 1, (void *) driver, sizeof(php_http_client_driver_t), NULL); } -PHP_HTTP_API STATUS php_http_client_driver_get(char **name_str, uint *name_len, php_http_client_driver_t *driver) +PHP_HTTP_API STATUS php_http_client_driver_get(const char *name_str, size_t name_len, php_http_client_driver_t *driver) { php_http_client_driver_t *tmp; - if (*name_str && SUCCESS == zend_hash_find(&php_http_client_drivers, *name_str, (*name_len) + 1, (void *) &tmp)) { - *driver = *tmp; - return SUCCESS; - } else if (SUCCESS == zend_hash_get_current_data(&php_http_client_drivers, (void *) &tmp)) { - zend_hash_get_current_key_ex(&php_http_client_drivers, name_str, name_len, NULL, 0, NULL); - --(*name_len); + if ((name_str && SUCCESS == zend_hash_find(&php_http_client_drivers, name_str, name_len + 1, (void *) &tmp)) + || (SUCCESS == zend_hash_get_current_data(&php_http_client_drivers, (void *) &tmp))) { *driver = *tmp; return SUCCESS; } return FAILURE; } +static int apply_driver_list(void *p, void *arg TSRMLS_DC) +{ + php_http_client_driver_t *d = p; + zval *zname; + + MAKE_STD_ZVAL(zname); + ZVAL_STRINGL(zname, d->name_str, d->name_len, 1); + + zend_hash_next_index_insert(arg, &zname, sizeof(zval *), NULL); + return ZEND_HASH_APPLY_KEEP; +} + +PHP_HTTP_API void php_http_client_driver_list(HashTable *ht TSRMLS_DC) +{ + zend_hash_apply_with_argument(&php_http_client_drivers, apply_driver_list, ht TSRMLS_CC); +} + void php_http_client_options_set_subr(zval *this_ptr, char *key, size_t len, zval *opts, int overwrite TSRMLS_DC) { if (overwrite || (opts && zend_hash_num_elements(Z_ARRVAL_P(opts)))) { @@ -420,20 +433,30 @@ static STATUS handle_response(void *arg, php_http_client_t *client, php_http_cli return SUCCESS; } -static void handle_progress(void *arg, php_http_client_t *client, php_http_client_enqueue_t *e, php_http_client_progress_state_t *state) +static void handle_progress(void *arg, php_http_client_t *client, php_http_client_enqueue_t *e, php_http_client_progress_state_t *progress) { - zval *zrequest, *retval = NULL, *zclient; + zval *zrequest, *zprogress, *retval = NULL, *zclient; TSRMLS_FETCH_FROM_CTX(client->ts); MAKE_STD_ZVAL(zclient); ZVAL_OBJVAL(zclient, ((php_http_client_object_t *) arg)->zv, 1); MAKE_STD_ZVAL(zrequest); ZVAL_OBJVAL(zrequest, ((php_http_message_object_t *) e->opaque)->zv, 1); + MAKE_STD_ZVAL(zprogress); + object_init(zprogress); + add_property_bool(zprogress, "started", progress->started); + add_property_bool(zprogress, "finished", progress->finished); + add_property_string(zprogress, "info", STR_PTR(progress->info), 1); + add_property_double(zprogress, "dltotal", progress->dl.total); + add_property_double(zprogress, "dlnow", progress->dl.now); + add_property_double(zprogress, "ultotal", progress->ul.total); + add_property_double(zprogress, "ulnow", progress->ul.now); with_error_handling(EH_NORMAL, NULL) { - zend_call_method_with_1_params(&zclient, NULL, NULL, "notify", &retval, zrequest); + zend_call_method_with_2_params(&zclient, NULL, NULL, "notify", &retval, zrequest, zprogress); } end_error_handling(); zval_ptr_dtor(&zclient); zval_ptr_dtor(&zrequest); + zval_ptr_dtor(&zprogress); if (retval) { zval_ptr_dtor(&retval); } @@ -460,7 +483,7 @@ static PHP_METHOD(HttpClient, __construct) if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ss", &driver_str, &driver_len, &persistent_handle_str, &persistent_handle_len)) { php_http_client_driver_t driver; - if (SUCCESS == php_http_client_driver_get(&driver_str, (uint *) &driver_len, &driver)) { + if (SUCCESS == php_http_client_driver_get(driver_str, driver_len, &driver)) { php_resource_factory_t *rf = NULL; php_http_client_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); zval *os; @@ -475,7 +498,8 @@ static PHP_METHOD(HttpClient, __construct) size_t name_len; php_persistent_handle_factory_t *pf; - name_len = spprintf(&name_str, 0, "http\\Client\\%s", php_http_pretty_key(driver_str, driver_len, 1, 1)); + name_len = spprintf(&name_str, 0, "http\\Client\\%s", driver.name_str); + php_http_pretty_key(name_str + sizeof("http\\Client"), driver.name_len, 1, 1); if ((pf = php_persistent_handle_concede(NULL , name_str, name_len, persistent_handle_str, persistent_handle_len, NULL, NULL TSRMLS_CC))) { rf = php_resource_factory_init(NULL, php_persistent_handle_get_resource_factory_ops(), pf, (void (*)(void *)) php_persistent_handle_abandon); @@ -535,7 +559,7 @@ static HashTable *combined_options(zval *client, zval *request TSRMLS_DC) } if (z_roptions) { if (Z_TYPE_P(z_roptions) == IS_ARRAY) { - array_join(Z_ARRVAL_P(z_roptions), options, 1, 0); + array_join(Z_ARRVAL_P(z_roptions), options, 0, 0); } zval_ptr_dtor(&z_roptions); } @@ -792,18 +816,11 @@ static PHP_METHOD(HttpClient, enableEvents) static int notify(zend_object_iterator *iter, void *puser TSRMLS_DC) { - zval **observer = NULL, **args = puser; + zval **observer = NULL, ***args = puser; iter->funcs->get_current_data(iter, &observer TSRMLS_CC); if (observer) { - zval *retval = NULL; - - zend_call_method(observer, NULL, NULL, ZEND_STRL("update"), &retval, args[1]?2:1, args[0], args[1] TSRMLS_CC); - if (retval) { - zval_ptr_dtor(&retval); - } - - return SUCCESS; + return php_http_method_call(*observer, ZEND_STRL("update"), args[2]?3:args[1]?2:args[0]?1:0, args, NULL TSRMLS_CC); } return FAILURE; } @@ -813,23 +830,30 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_notify, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpClient, notify) { - zval *request = NULL; + zval *request = NULL, *zprogress = NULL; - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|O!", &request, php_http_client_request_get_class_entry())) { - zval *args[2], *observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0 TSRMLS_CC); + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|O!o!", &request, php_http_client_request_get_class_entry(), &zprogress)) { + zval **args[3], *observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0 TSRMLS_CC); if (Z_TYPE_P(observers) == IS_OBJECT) { Z_ADDREF_P(getThis()); + args[0] = &getThis(); if (request) { Z_ADDREF_P(request); } - args[0] = getThis(); - args[1] = request; - spl_iterator_apply(observers, notify, &args TSRMLS_CC); + args[1] = &request; + if (zprogress) { + Z_ADDREF_P(zprogress); + } + args[2] = &zprogress; + spl_iterator_apply(observers, notify, args TSRMLS_CC); zval_ptr_dtor(&getThis()); if (request) { zval_ptr_dtor(&request); } + if (zprogress) { + zval_ptr_dtor(&zprogress); + } } } @@ -1025,6 +1049,15 @@ static PHP_METHOD(HttpClient, getCookies) } } +ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_getAvailableDrivers, 0, 0, 0) +ZEND_END_ARG_INFO(); +static PHP_METHOD(HttpClient, getAvailableDrivers) { + if (SUCCESS == zend_parse_parameters_none()) { + array_init(return_value); + php_http_client_driver_list(Z_ARRVAL_P(return_value) TSRMLS_CC); + } +} + static zend_function_entry php_http_client_methods[] = { PHP_ME(HttpClient, __construct, ai_HttpClient_construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(HttpClient, reset, ai_HttpClient_reset, ZEND_ACC_PUBLIC) @@ -1052,6 +1085,7 @@ static zend_function_entry php_http_client_methods[] = { PHP_ME(HttpClient, setCookies, ai_HttpClient_setCookies, ZEND_ACC_PUBLIC) PHP_ME(HttpClient, addCookies, ai_HttpClient_addCookies, ZEND_ACC_PUBLIC) PHP_ME(HttpClient, getCookies, ai_HttpClient_getCookies, ZEND_ACC_PUBLIC) + PHP_ME(HttpClient, getAvailableDrivers, ai_HttpClient_getAvailableDrivers, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) EMPTY_FUNCTION_ENTRY }; diff --git a/php_http_client.h b/php_http_client.h index 42b7131..9a7c630 100644 --- a/php_http_client.h +++ b/php_http_client.h @@ -50,11 +50,13 @@ typedef struct php_http_client_ops { } php_http_client_ops_t; typedef struct php_http_client_driver { + const char *name_str; + size_t name_len; php_http_client_ops_t *client_ops; } php_http_client_driver_t; -PHP_HTTP_API STATUS php_http_client_driver_add(const char *name_str, uint name_len, php_http_client_driver_t *driver); -PHP_HTTP_API STATUS php_http_client_driver_get(char **name_str, uint *name_len, php_http_client_driver_t *driver); +PHP_HTTP_API STATUS php_http_client_driver_add(php_http_client_driver_t *driver); +PHP_HTTP_API STATUS php_http_client_driver_get(const char *name_str, size_t name_len, php_http_client_driver_t *driver); typedef struct php_http_client_progress_state { struct { diff --git a/php_http_client_curl.c b/php_http_client_curl.c index fb8ecf6..460f62b 100644 --- a/php_http_client_curl.c +++ b/php_http_client_curl.c @@ -1862,10 +1862,11 @@ PHP_MINIT_FUNCTION(http_client_curl) { php_http_options_t *options; php_http_client_driver_t driver = { + ZEND_STRL("curl"), &php_http_client_curl_ops }; - if (SUCCESS != php_http_client_driver_add(ZEND_STRL("curl"), &driver)) { + if (SUCCESS != php_http_client_driver_add(&driver)) { return FAILURE; } diff --git a/php_http_misc.c b/php_http_misc.c index f14354a..092662a 100644 --- a/php_http_misc.c +++ b/php_http_misc.c @@ -289,6 +289,34 @@ void php_http_error(long type TSRMLS_DC, long code, const char *format, ...) va_end(args); } +/* ZEND */ + +STATUS php_http_method_call(zval *object, const char *method_str, size_t method_len, int argc, zval **argv[], zval **retval_ptr TSRMLS_DC) +{ + zend_fcall_info fci; + zval zmethod; + zval *retval; + STATUS rv; + + fci.size = sizeof(fci); + fci.object_ptr = object; + fci.function_name = &zmethod; + fci.retval_ptr_ptr = retval_ptr ? retval_ptr : &retval; + fci.param_count = argc; + fci.params = argv; + fci.no_separation = 1; + fci.symbol_table = NULL; + fci.function_table = NULL; + + INIT_PZVAL(&zmethod); + ZVAL_STRINGL(&zmethod, method_str, method_len, 0); + rv = zend_call_function(&fci, NULL TSRMLS_CC); + + if (!retval_ptr && retval) { + zval_ptr_dtor(&retval); + } + return rv; +} /* * Local variables: * tab-width: 4 diff --git a/php_http_misc.h b/php_http_misc.h index 69076e7..314fc24 100644 --- a/php_http_misc.h +++ b/php_http_misc.h @@ -200,6 +200,8 @@ static inline STATUS php_http_ini_entry(const char *name_str, size_t name_len, c return FAILURE; } +STATUS php_http_method_call(zval *object, const char *method_str, size_t method_len, int argc, zval **argv[], zval **retval_ptr TSRMLS_DC); + /* return bool (v == SUCCESS) */ #define RETVAL_SUCCESS(v) RETVAL_BOOL(SUCCESS == (v)) #define RETURN_SUCCESS(v) RETURN_BOOL(SUCCESS == (v)) diff --git a/tests/client001.phpt b/tests/client001.phpt new file mode 100644 index 0000000..8071afa --- /dev/null +++ b/tests/client001.phpt @@ -0,0 +1,21 @@ +--TEST-- +client drivers +--SKIPIF-- + +--FILE-- + +Done +--EXPECTREGEX-- +Test +(?:bool\(true\) +)+Done diff --git a/tests/client002.phpt b/tests/client002.phpt new file mode 100644 index 0000000..44ff3d1 --- /dev/null +++ b/tests/client002.phpt @@ -0,0 +1,37 @@ +--TEST-- +client observer +--SKIPIF-- + +--FILE-- +getProgressInfo($request) != $progress) { + var_dump($progress); + } + } +} + +$observer = new Observer; +$request = new http\Client\Request("GET", "http://www.example.org/"); + +foreach (http\Client::getAvailableDrivers() as $driver) { + $client = new http\Client($driver); + $client->attach($observer); + $client->enqueue($request); + $client->send(); +} + +?> + +Done +--EXPECTREGEX-- +Test +P+ +Done diff --git a/tests/client003.phpt b/tests/client003.phpt new file mode 100644 index 0000000..b09c299 --- /dev/null +++ b/tests/client003.phpt @@ -0,0 +1,29 @@ +--TEST-- +client once & wait +--SKIPIF-- + +--FILE-- +enqueue($request); + + while ($client->once()) { + $client->wait(.1); + } + + if (!$client->getResponse()) { + var_dump($client); + } +} +?> +Done +--EXPECT-- +Test +Done diff --git a/tests/client004.phpt b/tests/client004.phpt new file mode 100644 index 0000000..22ad9fe --- /dev/null +++ b/tests/client004.phpt @@ -0,0 +1,35 @@ +--TEST-- +client reset +--SKIPIF-- + +--FILE-- +enqueue($request)->send(); + if (!($client->getResponse($request) instanceof http\Client\Response)) { + var_dump($client); + } + try { + $client->enqueue($request); + } catch (Exception $e) { + echo $e->getMessage(),"\n"; + } + $client->reset(); + if (($response = $client->getResponse())) { + var_dump($response); + } + $client->enqueue($request); +} +?> +Done +--EXPECTREGEX-- +Test +(?:Failed to enqueue request; request already in queue +)+Done diff --git a/tests/client005.phpt b/tests/client005.phpt new file mode 100644 index 0000000..36a3f0a --- /dev/null +++ b/tests/client005.phpt @@ -0,0 +1,27 @@ +--TEST-- +client response callback +--SKIPIF-- + +--FILE-- +enqueue(new http\Client\Request("GET", "http://www.example.org"), function($response) { + echo "R\n"; + if (!($response instanceof http\Client\Response)) { + var_dump($response); + } + }); + $client->send(); +} + +?> +Done +--EXPECTREGEX-- +Test +(?:R +)+Done diff --git a/tests/client006.phpt b/tests/client006.phpt new file mode 100644 index 0000000..762e044 --- /dev/null +++ b/tests/client006.phpt @@ -0,0 +1,42 @@ +--TEST-- +client response callback + dequeue +--SKIPIF-- + +--FILE-- +enqueue($request, "response"); + $client->send(); + try { + $client->dequeue($request); + } catch (Exception $e) { + echo $e->getMessage(),"\n"; + } + } +} + +?> +Done +--EXPECTREGEX-- +Test +(?:(?:R +Failed to dequeue request; request not in queue +)+)+Done diff --git a/tests/client007.phpt b/tests/client007.phpt new file mode 100644 index 0000000..8421b51 --- /dev/null +++ b/tests/client007.phpt @@ -0,0 +1,34 @@ +--TEST-- +client response callback + requeue +--SKIPIF-- + +--FILE-- +requeue($request, "response"); + $client->send(); + } +} + +?> +Done +--EXPECTREGEX-- +Test +(?:R +R +)+Done diff --git a/tests/client008.phpt b/tests/client008.phpt new file mode 100644 index 0000000..d7fe358 --- /dev/null +++ b/tests/client008.phpt @@ -0,0 +1,36 @@ +--TEST-- +client features +--SKIPIF-- + +--FILE-- +enablePipelining(true); + $client->enableEvents(true); + + $client->enqueue($request); + $client->enqueue(clone $request); + $client->enqueue(clone $request); + + $client->send(); + + while ($client->getResponse()) { + echo "R\n"; + } +} + +?> +Done +--EXPECTREGEX-- +Test +(?:R +R +R +)+Done diff --git a/tests/client009.phpt b/tests/client009.phpt new file mode 100644 index 0000000..937045d --- /dev/null +++ b/tests/client009.phpt @@ -0,0 +1,47 @@ +--TEST-- +client static cookies +--SKIPIF-- + +--FILE-- +setCookies(array("test" => "bar")); + $client->addCookies(array("foo" => "test")); + $client->enqueue($request); + $client->send(); + var_dump($client->getResponse()->getBody()->toString()); + $request->setOptions(array("cookies" => x($client->getCookies()))); + $client->requeue($request); + $client->send(); + var_dump($client->getResponse()->getBody()->toString()); +} + +?> +Done +--EXPECTREGEX-- +Test +(?:string\(46\) "Array +\( + \[test\] \=\> bar + \[foo\] \=\> test +\) +" +string\(46\) "Array +\( + \[test\] \=\> test + \[foo\] \=\> bar +\) +" +)+Done diff --git a/tests/client010.phpt b/tests/client010.phpt new file mode 100644 index 0000000..7563a77 --- /dev/null +++ b/tests/client010.phpt @@ -0,0 +1,36 @@ +--TEST-- +client upload +--SKIPIF-- + +--FILE-- +getBody()->addForm(null, array("file"=>__FILE__, "name"=>"upload", "type"=>"text/plain")); + +foreach (http\Client::getAvailableDrivers() as $driver) { + $client = new http\Client($driver); + $client->enqueue($request)->send(); + var_dump($client->getResponse()->getBody()->toString()); +} +?> +Done +--EXPECTREGEX-- +Test +(?:string\(\d+\) "Array +\( + \[upload\] \=\> Array + \( + \[name\] \=\> client010\.php + \[type\] \=\> text\/plain + \[tmp_name\] \=\> .* + \[error\] \=\> 0 + \[size\] \=\> \d+ + \) + +\) +" +)+Done diff --git a/tests/clientresponse001.phpt b/tests/clientresponse001.phpt new file mode 100644 index 0000000..2f25291 --- /dev/null +++ b/tests/clientresponse001.phpt @@ -0,0 +1,45 @@ +--TEST-- +client response cookie +--SKIPIF-- + +--FILE-- +enqueue($request)->send()->getResponse()->getCookies(0, array("comment")) as $cookies) { + var_dump($cookies->toArray()); + } +} +?> +Done +--EXPECTREGEX-- +Test +(?:array\(7\) \{ + \["cookies"\]\=\> + array\(2\) \{ + \["foo"\]\=\> + string\(3\) "bar" + \["bar"\]\=\> + string\(3\) "foo" + \} + \["extras"\]\=\> + array\(0\) \{ + \} + \["flags"\]\=\> + int\(0\) + \["expires"\]\=\> + int\(\-1\) + \["max\-age"\]\=\> + int\(\-1\) + \["path"\]\=\> + string\(0\) "" + \["domain"\]\=\> + string\(0\) "" +\} +)+Done diff --git a/tests/clientresponse002.phpt b/tests/clientresponse002.phpt new file mode 100644 index 0000000..6cc3c3a --- /dev/null +++ b/tests/clientresponse002.phpt @@ -0,0 +1,63 @@ +--TEST-- +client response cookies +--SKIPIF-- + +--FILE-- +enqueue($request)->send()->getResponse()->getCookies(0, array("comment")) as $cookies) { + var_dump($cookies->toArray()); + } +} +?> +Done +--EXPECTREGEX-- +Test +(?:array\(7\) \{ + \["cookies"\]\=\> + array\(1\) \{ + \["temp"\]\=\> + string\(13\) "\d+\.\d+" + \} + \["extras"\]\=\> + array\(0\) \{ + \} + \["flags"\]\=\> + int\(0\) + \["expires"\]\=\> + int\(\-1\) + \["max\-age"\]\=\> + int\(\-1\) + \["path"\]\=\> + string\(0\) "" + \["domain"\]\=\> + string\(0\) "" +\} +array\(7\) \{ + \["cookies"\]\=\> + array\(1\) \{ + \["perm"\]\=\> + string\(13\) "\d+\.\d+" + \} + \["extras"\]\=\> + array\(0\) \{ + \} + \["flags"\]\=\> + int\(0\) + \["expires"\]\=\> + int\(\d+\) + \["max\-age"\]\=\> + int\(\-1\) + \["path"\]\=\> + string\(0\) "" + \["domain"\]\=\> + string\(0\) "" +\} +)+Done diff --git a/tests/clientresponse003.phpt b/tests/clientresponse003.phpt new file mode 100644 index 0000000..a119951 --- /dev/null +++ b/tests/clientresponse003.phpt @@ -0,0 +1,25 @@ +--TEST-- +client response transfer info +--SKIPIF-- + +--FILE-- +enqueue($request)->send()->getResponse(); + var_dump($response->getTransferInfo("response_code")); + var_dump(count($response->getTransferInfo())); +} +?> +Done +--EXPECTREGEX-- +Test +(?:int\([1-5]\d\d\) +int\(\d\d\) +)+Done diff --git a/tests/envrequestfiles001.phpt b/tests/envrequestfiles001.phpt index 5b1cd2e..9a577c9 100644 --- a/tests/envrequestfiles001.phpt +++ b/tests/envrequestfiles001.phpt @@ -1,5 +1,5 @@ --TEST-- -http\Env\Request grabbing $_FILES +env request grabbing $_FILES --SKIPIF-- --POST_RAW-- diff --git a/tests/envrequestfiles002.phpt b/tests/envrequestfiles002.phpt index 85b44db..afc5144 100644 --- a/tests/envrequestfiles002.phpt +++ b/tests/envrequestfiles002.phpt @@ -1,5 +1,5 @@ --TEST-- -http\Env\Request grabbing $_FILES from array +env request grabbing $_FILES from array --SKIPIF-- --POST_RAW-- diff --git a/tests/envrequestform.phpt b/tests/envrequestform.phpt index c2086bb..337bb54 100644 --- a/tests/envrequestform.phpt +++ b/tests/envrequestform.phpt @@ -1,5 +1,5 @@ --TEST-- -http\Env\Request getForm +env request form --SKIPIF-- --POST-- diff --git a/tests/envrequestquery.phpt b/tests/envrequestquery.phpt index 87f168d..2e21ab9 100644 --- a/tests/envrequestquery.phpt +++ b/tests/envrequestquery.phpt @@ -1,5 +1,5 @@ --TEST-- -http\Env\Request getQuery +env request query --SKIPIF-- --GET-- diff --git a/tests/envresponsecodes.phpt b/tests/envresponsecodes.phpt index 21d7bbf..ec6ea21 100644 --- a/tests/envresponsecodes.phpt +++ b/tests/envresponsecodes.phpt @@ -1,5 +1,5 @@ --TEST-- -http\Env response codes +env response codes --SKIPIF-- --FILE-- diff --git a/tests/message001.phpt b/tests/message001.phpt index 9060ee4..230fd6b 100644 --- a/tests/message001.phpt +++ b/tests/message001.phpt @@ -1,5 +1,5 @@ --TEST-- -Message +message --SKIPIF--