@@ -43,6 +43,16 @@ public function testHeaderAuthWithMissingField()
4343 MockHelper::getClient ()->validateAuth ($ auth );
4444 }
4545
46+ public function testHeaderAuthWithEmptyField ()
47+ {
48+ $ this ->expectException (AuthValidationException::class);
49+ $ this ->expectExceptionMessage ("Following authentication credentials are required: " .
50+ "\n-> Missing required header field: token " );
51+
52+ $ auth = Auth::or ('headerWithEmpty ' );
53+ MockHelper::getClient ()->validateAuth ($ auth );
54+ }
55+
4656 public function testHeaderOrQueryAuth1 ()
4757 {
4858 $ request = new Request ('http://localhost:3000 ' );
@@ -85,6 +95,19 @@ public function testHeaderWithMissingFieldOrQueryAuth()
8595 );
8696 }
8797
98+ public function testHeaderWithEmptyFieldOrQueryAuth ()
99+ {
100+ $ request = new Request ('http://localhost:3000 ' );
101+ $ auth = Auth::or ('headerWithEmpty ' , 'query ' );
102+ MockHelper::getClient ()->validateAuth ($ auth )->apply ($ request );
103+
104+ $ this ->assertEquals ([], $ request ->getHeaders ());
105+ $ this ->assertEquals (
106+ 'http://localhost:3000?token=someAuthToken&authorization=accessToken ' ,
107+ $ request ->getQueryUrl ()
108+ );
109+ }
110+
88111 public function testHeaderOrQueryAuthWithMissingFields ()
89112 {
90113 $ this ->expectException (AuthValidationException::class);
@@ -122,6 +145,16 @@ public function testHeaderWithMissingFieldAndQueryAuth()
122145 MockHelper::getClient ()->validateAuth ($ auth );
123146 }
124147
148+ public function testHeaderWithEmptyFieldAndQueryAuth ()
149+ {
150+ $ this ->expectException (AuthValidationException::class);
151+ $ this ->expectExceptionMessage ("Following authentication credentials are required: " .
152+ "\n-> Missing required header field: token " );
153+
154+ $ auth = Auth::and ('headerWithEmpty ' , 'query ' );
155+ MockHelper::getClient ()->validateAuth ($ auth );
156+ }
157+
125158 public function testHeaderAndQueryAuthWithMissingFields ()
126159 {
127160 $ this ->expectException (AuthValidationException::class);
0 commit comments