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