Annotation of embedaddon/php/ext/curl/tests/curl_copy_handle_variation2.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test curl_copy_handle() add options to the handles
3: --CREDITS--
4: Francesco Fullone ff@ideato.it
5: #PHPTestFest Cesena Italia on 2009-06-20
6: --SKIPIF--
7: <?php
8: if (!extension_loaded("curl")) exit("skip curl extension not loaded");
9: ?>
10: --COMMENT--
11: the only way to test if a option is setten on a curl handle is using the curl_getinfo() function.
12: but this can only check on a limited amount of options...
13: --FILE--
14: <?php
15: echo "*** Testing curl_copy_handle(): add options after copy ***\n";
16:
17: // create a new cURL resource
18: $ch = curl_init();
19:
20: // copy the handle
21: $ch2 = curl_copy_handle($ch);
22: var_dump(curl_getinfo($ch) === curl_getinfo($ch2));
23:
24: // add some CURLOPT to the second handle
25: curl_setopt($ch2, CURLOPT_URL, 'http://www.example.com/');
26:
27: var_dump(curl_getinfo($ch) === curl_getinfo($ch2));
28:
29: // add same CURLOPT to the first handle
30: curl_setopt($ch, CURLOPT_URL, 'http://www.example.com/');
31: var_dump(curl_getinfo($ch) === curl_getinfo($ch2));
32:
33: // change a CURLOPT in the second handle
34: curl_setopt($ch2, CURLOPT_URL, 'http://www.bar.com/');
35: var_dump(curl_getinfo($ch) === curl_getinfo($ch2));
36: ?>
37: ===DONE===
38: --EXPECTF--
39: *** Testing curl_copy_handle(): add options after copy ***
40: bool(true)
41: bool(false)
42: bool(true)
43: bool(false)
44: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>