@@ -68,6 +68,29 @@ public function testUserContextHash()
6868 $ this ->assertHit ($ headResponse2 );
6969 }
7070
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+
7194 public function testAcceptHeader ()
7295 {
7396 $ response1 = $ this ->getResponse (
0 commit comments