@@ -217,6 +217,45 @@ public function testWithParsedBody() {
217217 self ::assertCount (2 , $ sut ->getParsedBody ()->asArray ());
218218 }
219219
220+ public function testGetAttributesEmpty () {
221+ $ sut = self ::getServerRequest ();
222+ self ::assertEmpty ($ sut ->getAttributes ());
223+ }
224+
225+ public function testWithAttribute () {
226+ $ sutWithout = self ::getServerRequest ();
227+ $ sutWith = $ sutWithout ->withAttribute ("testAttr " , "testValue " );
228+ self ::assertEmpty ($ sutWithout ->getAttributes ());
229+ self ::assertCount (1 , $ sutWith ->getAttributes ());
230+ }
231+
232+ public function testGetAttribute () {
233+ $ sut = self ::getServerRequest ()
234+ ->withAttribute ("testAttr " , "testValue " );
235+ self ::assertEquals (
236+ "testValue " ,
237+ $ sut ->getAttribute ("testAttr " )
238+ );
239+ }
240+
241+ public function testGetAttributeDefault () {
242+ $ sut = self ::getServerRequest ()
243+ ->withAttribute ("testAttr " , "testValue " );
244+ self ::assertEquals (
245+ "defaultValue " ,
246+ $ sut ->getAttribute ("notExists " , "defaultValue " )
247+ );
248+ }
249+
250+ public function testGetAttributeWithout () {
251+ $ sut = self ::getServerRequest ()
252+ ->withAttribute ("testAttr1 " , "testValue1 " )
253+ ->withAttribute ("testAttr2 " , "testValue2 " )
254+ ->withAttribute ("testAttr3 " , "testValue3 " )
255+ ->withoutAttribute ("testAttr2 " );
256+ self ::assertCount (2 , $ sut ->getAttributes ());
257+ }
258+
220259 protected function getServerRequest (
221260 string $ method = null ,
222261 string $ uri = null ,
0 commit comments