X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=phpunit%2FHeaderTest.php;h=c04a7f739f8de487c9805bdde455761ea5902f3c;hb=0327131cf87a5be32585fea1291178b60a359cbf;hp=b34adcb5e9e525183d71f0129b1008645552c575;hpb=cd4b861addec695f3b7d78c5184294c34c5ab732;p=m6w6%2Fext-http diff --git a/phpunit/HeaderTest.php b/phpunit/HeaderTest.php index b34adcb..c04a7f7 100644 --- a/phpunit/HeaderTest.php +++ b/phpunit/HeaderTest.php @@ -57,4 +57,27 @@ class HeaderTest extends PHPUnit_Framework_TestCase { $this->setExpectedException("PHPUnit_Framework_Error_Warning", "Could not parse headers"); $this->assertFalse(http\Header::parse($header)); } + + function testParams() { + $header = new http\Header("Cache-control", "public, must-revalidate, max-age=0"); + $this->assertEquals( + array( + "public" => array("value" => true, "arguments" => array()), + "must-revalidate" => array("value" => true, "arguments" => array()), + "max-age" => array("value" => 0, "arguments" => array()), + ), + $header->getParams()->params + ); + } + + function testParamsWithArgs() { + $header = new http\Header("Custom", '"foo" is "bar". "bar" is "bis" where "bis" is 3.'); + $this->assertEquals( + array( + "foo" => array("value" => "bar", "arguments" => array()), + "bar" => array("value" => "baz", "arguments" => array("baz" => "3")) + ), + $header->getParams(".", "where", "is")->params + ); + } }