@@ -68,6 +68,29 @@ public function testUserContextHash()
68
68
$ this ->assertHit ($ headResponse2 );
69
69
}
70
70
71
+ /**
72
+ * Making sure that non-authenticated and authenticated cache are not mixed up.
73
+ */
74
+ public function testUserContextNoAuth ()
75
+ {
76
+ $ response1 = $ this ->getResponse ('/user_context_anon.php ' );
77
+ $ this ->assertEquals ('anonymous ' , $ response1 ->getBody (true ));
78
+ $ this ->assertEquals ('MISS ' , $ response1 ->getHeader ('X-HashCache ' ));
79
+
80
+ $ response1 = $ this ->getResponse ('/user_context_anon.php ' , array (), array ('cookies ' => array ('foo ' )));
81
+ $ this ->assertEquals ('foo ' , $ response1 ->getBody (true ));
82
+ $ this ->assertEquals ('MISS ' , $ response1 ->getHeader ('X-HashCache ' ));
83
+
84
+ $ cachedResponse1 = $ this ->getResponse ('/user_context_anon.php ' );
85
+ $ this ->assertEquals ('anonymous ' , $ cachedResponse1 ->getBody (true ));
86
+ $ this ->assertHit ($ cachedResponse1 );
87
+
88
+ $ cachedResponse1 = $ this ->getResponse ('/user_context_anon.php ' , array (), array ('cookies ' => array ('foo ' )));
89
+ $ this ->assertEquals ('foo ' , $ cachedResponse1 ->getBody (true ));
90
+ $ this ->assertContextCache ($ cachedResponse1 ->getHeader ('X-HashCache ' ));
91
+ $ this ->assertHit ($ cachedResponse1 );
92
+ }
93
+
71
94
public function testAcceptHeader ()
72
95
{
73
96
$ response1 = $ this ->getResponse (
0 commit comments