3 class DataShareTest
extends PHPUnit_Framework_TestCase
5 function testStandard() {
6 foreach (http\Client\Factory
::getAvailableDrivers() as $driver) {
7 $f = new http\Client\
Factory(compact("driver"));
8 $s = $f->createDataShare();
10 $this->assertFalse($s->dns
, "dns");
11 $this->assertFalse($s->cookie
, "cookie");
12 $this->assertFalse($s->ssl
, "ssl");
18 $this->assertTrue($s->dns
, "dns");
19 $this->assertTrue($s->cookie
, "cookie");
20 $this->assertTrue($s->ssl
, "ssl");
24 function testAttach() {
25 foreach (http\Client\Factory
::getAvailableDrivers() as $driver) {
26 $f = new http\Client\
Factory(compact("driver"));
27 $s = $f->createDataShare();
28 $s->dns
= $s->ssl
= $s->cookie
= true;
29 $c = $f->createClient();
31 $c->setRequest(new http\Client\
Request("GET", "https://twitter.com/"));
36 $this->assertEquals(3, count($s));
41 $client = new http\Curl\Client
;
42 $client->setRequest(new http\Client\
Request("GET", "https://twitter.com/"));
43 $share = new http\Curl\Client\DataShare
;
44 $share->ssl
= $share->dns
= $share->cookie
= true;
45 $share->attach($client);
46 $share->attach($client2 = clone $client);
47 $share->attach($client3 = clone $client);
49 $this->assertEquals(3, count($share));
54 $share->detach($client);