X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=phpunit%2FRequestTest.php;h=0072714c4c953789cd389da55125afd242ba3e76;hp=136b29f7433ecfcfb6809223916a027beb75d4d3;hb=05ae9a5d01e29d7174152b1b46a5af09833d71ef;hpb=d5de4f9eae86ae1dab0f8a906bf9543710ae124d diff --git a/phpunit/RequestTest.php b/phpunit/RequestTest.php index 136b29f..0072714 100644 --- a/phpunit/RequestTest.php +++ b/phpunit/RequestTest.php @@ -93,7 +93,27 @@ class RequestTest extends PHPUnit_Framework_TestCase $this->assertNotContains("Cookie", (string) $this->r->getRequestMessage()); $this->r->send(null); $this->assertContains("Cookie", (string) $this->r->getRequestMessage()); - $this->assertCount(2, $this->r->getResponseMessage()->getCookies()); + $cookies = $this->r->getResponseMessage()->getCookies(0, array("extra")); + $this->assertCount(2, $cookies); + foreach ($cookies as $cookie) { + if ($cookie->getCookie("perm")) { + $this->assertTrue(0 < $cookie->getExpires()); + } + if ($cookie->getCookie("temp")) { + $this->assertEquals(-1, $cookie->getExpires()); + } + } + $this->r->send(new http\Client\Request("GET", "http://dev.iworks.at/ext-http/.cookie1.php")); + $cookies = $this->r->getResponseMessage()->getCookies(0, array("bar")); + $this->assertCount(1, $cookies); + $cookies = $cookies[0]; + $this->assertEquals(array("bar"=>"foo"), $cookies->getExtras()); + $this->assertEquals(array("foo"=>"bar"), $cookies->getCookies()); + $cookies = $this->r->getResponseMessage()->getCookies(0, array("foo")); + $this->assertCount(1, $cookies); + $cookies = $cookies[0]; + $this->assertEquals(array("foo"=>"bar","bar"=>"foo"), $cookies->getCookies()); + $this->assertEquals(array(), $cookies->getExtras()); } function testResetCookies() {