<?php

/**
 * @namespace
 */
namespace ZendTest\Http;

use Zend\Http\Client;

class ClientTest extends \PHPUnit_Framework_TestCase
{
    public function testClientRetrievesUppercaseHttpMethodFromRequestObject()
    {
        $client = new Client;
        $client->setMethod('post');
        $this->assertEquals(Client::ENC_URLENCODED, $client->getEncType());
    }
    
    public function testIfZeroValueCookiesCanBeSet()
    {
        try {
            $client = new Client();
            $client->addCookie("test", 0);
            $client->addCookie("test2", "0");
            $client->addCookie("test3", false);
        } catch (Exception\InvalidArgumentException $e) {
            $this->fail('Zero Values should be valid');
        }
        $this->assertTrue(true);
    }
    
    /**
    * @expectedException Zend\Http\Exception\InvalidArgumentException
    */
    public function testIfNullValueCookiesThrowsException()
    {
        $client = new Client();
        $client->addCookie("test", null);
    } 
}

<?php

/**
 * @namespace
 */
namespace ZendTest\Http;

use Zend\Http\Client,
    Zend\Http\Header\SetCookie;

class ClientTest extends \PHPUnit_Framework_TestCase
{
    public function testClientRetrievesUppercaseHttpMethodFromRequestObject()
    {
        $client = new Client;
        $client->setMethod('post');
        $this->assertEquals(Client::ENC_URLENCODED, $client->getEncType());
    }
    
    public function testIfZeroValueCookiesCanBeSet()
    {
        try {
            $client = new Client();
            $client->addCookie("test", 0);
            $client->addCookie("test2", "0");
            $client->addCookie("test3", false);
        } catch (Exception\InvalidArgumentException $e) {
            $this->fail('Zero Values should be valid');
        }
        $this->assertTrue(true);
    }
    
    /**
    * @expectedException Zend\Http\Exception\InvalidArgumentException
    */
    public function testIfNullValueCookiesThrowsException()
    {
        $client = new Client();
        $client->addCookie("test", null);
    } 

    public function testIfCookieHeaderCanBeSet()
    {
        $header = new SetCookie('foo');

        $client = new Client();
        $client->addCookie($header);
        
        $cookies = $client->getCookies();
        $this->assertEquals(1, count($cookies));
        $this->assertEquals($header, $cookies['foo']);
    }

    public function testIfArrayOfHeadersCanBeSet()
    {
        $headers = array(
            new SetCookie('foo'),
            new SetCookie('bar')
        );

        $client = new Client();
        $client->addCookie($headers);
        
        $cookies = $client->getCookies();
        $this->assertEquals(2, count($cookies));
    }

    public function testIfArrayIteratorOfHeadersCanBeSet()
    {
        $headers = new \ArrayIterator(array(
            new SetCookie('foo'),
            new SetCookie('bar')
        ));
        
        $client = new Client();
        $client->addCookie($headers);
        
        $cookies = $client->getCookies();
        $this->assertEquals(2, count($cookies));
    }
}

Add tests for setting cookies with SetCookie header
Add tests for setting cookies with SetCookie header