14 'zoo' => array(
'foo',
'Foo'),
20 $i =
new Header(
'Zoo', $this->test);
21 $this->assertEquals(
'Zoo', $i->getName());
26 $i =
new Header(
'Zoo', $this->test);
27 $this->assertEquals(
'foo, Foo, bar', (
string) $i);
29 $this->assertEquals(
'foo; Foo; bar', (
string) $i);
34 $h =
new Header(
'Zoo', array(
'foo, Faz',
'bar'));
35 $result = $h->normalize(
true)->toArray();
37 $this->assertEquals(array(
'bar',
'foo',
'Faz'), $result);
42 $h =
new Header(
'Zoo', $this->test);
43 $this->assertTrue($h->hasValue(
'foo'));
44 $this->assertTrue($h->hasValue(
'Foo'));
45 $this->assertTrue($h->hasValue(
'bar'));
46 $this->assertFalse($h->hasValue(
'moo'));
47 $this->assertFalse($h->hasValue(
'FoO'));
52 $h =
new Header(
'Zoo', $this->test);
53 $this->assertEquals(3, count($h));
58 $h =
new Header(
'Zoo', $this->test);
60 foreach ($h as $key => $value) {
61 $results[$key] = $value;
63 $this->assertEquals(array(
71 $h =
new Header(
'Foo', 0,
';');
72 $this->assertEquals(
'0', (
string) $h);
73 $this->assertEquals(1, count($h));
74 $this->assertEquals(
';', $h->getGlue());
78 $this->assertEquals(
'', (
string) $h);
79 $this->assertEquals(0, count($h));
82 $h =
new Header(
'Foo', array(
null));
83 $this->assertEquals(
'', (
string) $h);
86 $h =
new Header(
'Foo',
'');
87 $this->assertEquals(
'', (
string) $h);
88 $this->assertEquals(1, count($h));
89 $this->assertEquals(1, count($h->normalize()->toArray()));
94 $h =
new Header(
'Foo', array(
'Foo',
'baz',
'bar'));
95 $h->removeValue(
'bar');
96 $this->assertTrue($h->hasValue(
'Foo'));
97 $this->assertFalse($h->hasValue(
'bar'));
98 $this->assertTrue($h->hasValue(
'baz'));
103 $h =
new Header(
'Foo', array(
'Testing',
'123',
'Foo=baz'));
104 $this->assertEquals(array(
'Testing',
'123',
'Foo=baz'), $h->toArray());
111 '<http:/.../front.jpeg>' =>
'',
113 'type' =>
'image/jpeg',
116 '<http://.../back.jpeg>' =>
'',
118 'type' =>
'image/jpeg',
124 '<http:/.../front.jpeg>; rel="front"; type="image/jpeg", <http://.../back.jpeg>; rel=back; type="image/jpeg"',
128 '<http:/.../front.jpeg>; rel="front"; type="image/jpeg",<http://.../back.jpeg>; rel=back; type="image/jpeg"',
132 'foo="baz"; bar=123, boo, test="123", foobar="foo;bar"',
134 array(
'foo' =>
'baz',
'bar' =>
'123'),
136 array(
'test' =>
'123'),
137 array(
'foobar' =>
'foo;bar')
141 '<http://.../side.jpeg?test=1>; rel="side"; type="image/jpeg",<http://.../side.jpeg?test=2>; rel=side; type="image/jpeg"',
143 array(
'<http://.../side.jpeg?test=1>' =>
'',
'rel' =>
'side',
'type' =>
'image/jpeg'),
144 array(
'<http://.../side.jpeg?test=2>' =>
'',
'rel' =>
'side',
'type' =>
'image/jpeg')
159 $response =
new Response(200, array(
'Link' => $header));
160 $this->assertEquals($result, $response->getHeader(
'Link')->parseParams());