@@ -24,6 +24,49 @@ public function testConstructor()
24
24
$ this ->assertTrue ($ bag ->has ('foo ' ));
25
25
}
26
26
27
+ public function testToStringNull ()
28
+ {
29
+ $ bag = new HeaderBag ();
30
+ $ this ->assertEquals ('' , $ bag ->__toString ());
31
+ }
32
+
33
+ public function testToStringNotNull ()
34
+ {
35
+ $ bag = new HeaderBag (array ('foo ' => 'bar ' ));
36
+ $ this ->assertEquals ("Foo: bar \r\n" , $ bag ->__toString ());
37
+ }
38
+
39
+ public function testKeys ()
40
+ {
41
+ $ bag = new HeaderBag (array ('foo ' => 'bar ' ));
42
+ $ keys = $ bag ->keys ();
43
+ $ this ->assertEquals ("foo " , $ keys [0 ]);
44
+ }
45
+
46
+ public function testGetDate ()
47
+ {
48
+ $ bag = new HeaderBag (array ('foo ' => 'Tue, 4 Sep 2012 20:00:00 +0200 ' ));
49
+ $ headerDate = $ bag ->getDate ('foo ' );
50
+ $ this ->assertInstanceOf ('DateTime ' , $ headerDate );
51
+ }
52
+
53
+ /**
54
+ * @expectedException \RuntimeException
55
+ */
56
+ public function testGetDateException ()
57
+ {
58
+ $ bag = new HeaderBag (array ('foo ' => 'Tue ' ));
59
+ $ headerDate = $ bag ->getDate ('foo ' );
60
+ }
61
+
62
+ public function testGetCacheControlHeader ()
63
+ {
64
+ $ bag = new HeaderBag ();
65
+ $ bag ->addCacheControlDirective ('public ' , '#a ' );<
5EC2
/div>
66
+ $ this ->assertTrue ($ bag ->hasCacheControlDirective ('public ' ));
67
+ $ this ->assertEquals ('#a ' , $ bag ->getCacheControlDirective ('public ' ));
68
+ }
69
+
27
70
/**
28
71
* @covers Symfony\Component\HttpFoundation\HeaderBag::all
29
72
*/
0 commit comments