File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -77,9 +77,19 @@ public function getTagsHeaderValue()
7777 }
7878
7979 /**
80- * Add tags to be sent .
80+ * Check whether the tag handler has any tags to set on the response .
8181 *
82- * This must be called before any response is sent to the client.
82+ * @return bool True if this handler will set at least one tag.
83+ */
84+ public function hasTags ()
85+ {
86+ return 0 < count ($ this ->tags );
87+ }
88+
89+ /**
90+ * Add tags to be set on the response.
91+ *
92+ * This must be called before any HTTP response is sent to the client.
8393 *
8494 * @param array $tags List of tags to add.
8595 *
Original file line number Diff line number Diff line change @@ -90,7 +90,9 @@ public function testTagResponse()
9090 ->getMock ();
9191
9292 $ tagHandler = new TagHandler ($ cacheInvalidator );
93+ $ this ->assertFalse ($ tagHandler ->hasTags ());
9394 $ tagHandler ->addTags (array ('post-1 ' , 'test,post ' ));
95+ $ this ->assertTrue ($ tagHandler ->hasTags ());
9496 $ this ->assertEquals ('post-1,test_post ' , $ tagHandler ->getTagsHeaderValue ());
9597 }
9698}
You can’t perform that action at this time.
0 commit comments