@@ -25,7 +25,7 @@ public function testWithNoIPRestrictions()
2525 */
2626 public function testWithValidIP ()
2727 {
28- $ model = factory (ApiKey::class)->make (['allowed_ips ' => [ ' 127.0.0.1 ' ] ]);
28+ $ model = factory (ApiKey::class)->make (['allowed_ips ' => ' [" 127.0.0.1"] ' ]);
2929 $ this ->setRequestAttribute ('api_key ' , $ model );
3030
3131 $ this ->request ->shouldReceive ('ip ' )->withNoArgs ()->once ()->andReturn ('127.0.0.1 ' );
@@ -38,7 +38,7 @@ public function testWithValidIP()
3838 */
3939 public function testValidIPAganistCIDRRange ()
4040 {
41- $ model = factory (ApiKey::class)->make (['allowed_ips ' => [ ' 192.168.1.1/28 ' ] ]);
41+ $ model = factory (ApiKey::class)->make (['allowed_ips ' => ' [" 192.168.1.1/28"] ' ]);
4242 $ this ->setRequestAttribute ('api_key ' , $ model );
4343
4444 $ this ->request ->shouldReceive ('ip ' )->withNoArgs ()->once ()->andReturn ('192.168.1.15 ' );
@@ -54,10 +54,10 @@ public function testValidIPAganistCIDRRange()
5454 */
5555 public function testWithInvalidIP ()
5656 {
57- $ model = factory (ApiKey::class)->make (['allowed_ips ' => [ ' 127.0.0.1 ' ] ]);
57+ $ model = factory (ApiKey::class)->make (['allowed_ips ' => ' [" 127.0.0.1"] ' ]);
5858 $ this ->setRequestAttribute ('api_key ' , $ model );
5959
60- $ this ->request ->shouldReceive ('ip ' )->withNoArgs ()->once ()->andReturn ('127.0.0.2 ' );
60+ $ this ->request ->shouldReceive ('ip ' )->withNoArgs ()->twice ()->andReturn ('127.0.0.2 ' );
6161
6262 $ this ->getMiddleware ()->handle ($ this ->request , $ this ->getClosureAssertions ());
6363 }
0 commit comments