4646 * @covers \CrowdSecBouncer\AbstractBouncer::shouldTrustXforwardedFor
4747 * @covers \CrowdSecBouncer\StandaloneBouncer::getHttpRequestHeader
4848 * @covers \CrowdSecBouncer\StandaloneBouncer::getRemoteIp
49- * @covers \CrowdSecBouncer\StandaloneBouncer::safelyBounce
49+ * @covers \CrowdSecBouncer\StandaloneBouncer::run
5050 * @covers \CrowdSecBouncer\StandaloneBouncer::shouldBounceCurrentIp
5151 * @covers \CrowdSecBouncer\StandaloneBouncer::getHttpMethod
5252 * @covers \CrowdSecBouncer\StandaloneBouncer::getPostedVariable
@@ -187,6 +187,7 @@ private function addTlsConfig(&$bouncerConfigs, $tlsPath)
187187
188188 public function testConstructAndSomeMethods ()
189189 {
190+ unset($ _SERVER ['REMOTE_ADDR ' ] );
190191 $ bouncer = new StandaloneBouncer (array_merge ($ this ->configs , ['unexpected_config ' => 'test ' ]));
191192 $ this ->assertEquals ('' , $ bouncer ->getRemoteIp (), 'Should return empty string ' );
192193 $ _SERVER ['REMOTE_ADDR ' ] = '5.6.7.8 ' ;
@@ -730,7 +731,7 @@ public function testCaptchaFlow()
730731 );
731732 }
732733
733- public function testSafelyBounce ()
734+ public function testRun ()
734735 {
735736 $ this ->assertEquals (
736737 false ,
@@ -749,7 +750,7 @@ public function testSafelyBounce()
749750 // Test 2: not bouncing exclude URI
750751 $ _SERVER ['REMOTE_ADDR ' ] = '127.0.0.2 ' ;
751752 $ _SERVER ['REQUEST_URI ' ] = self ::EXCLUDED_URI ;
752- $ this ->assertEquals (false , $ bouncer ->safelyBounce (), 'Should not bounce excluded uri ' );
753+ $ this ->assertEquals (false , $ bouncer ->run (), 'Should not bounce excluded uri ' );
753754 PHPUnitUtil::assertRegExp (
754755 $ this ,
755756 '/.*100.*Will not bounce as URI is excluded/ ' ,
@@ -760,12 +761,12 @@ public function testSafelyBounce()
760761 // Test 3: bouncing URI
761762 $ _SERVER ['REMOTE_ADDR ' ] = '127.0.0.3 ' ;
762763 $ _SERVER ['REQUEST_URI ' ] = '/home ' ;
763- $ this ->assertEquals (true , $ bouncer ->safelyBounce (), 'Should bounce uri ' );
764+ $ this ->assertEquals (true , $ bouncer ->run (), 'Should bounce uri ' );
764765 // Test 4: not bouncing URI if disabled
765766 $ _SERVER ['REMOTE_ADDR ' ] = '127.0.0.4 ' ;
766767 $ bouncer = new StandaloneBouncer (array_merge ($ this ->configs , ['bouncing_level ' =>
767768 Constants::BOUNCING_LEVEL_DISABLED ]), $ this ->logger );
768- $ this ->assertEquals (false , $ bouncer ->safelyBounce (), 'Should not bounce if disabled ' );
769+ $ this ->assertEquals (false , $ bouncer ->run (), 'Should not bounce if disabled ' );
769770
770771 PHPUnitUtil::assertRegExp (
771772 $ this ,
@@ -789,7 +790,7 @@ public function testSafelyBounce()
789790 $ error = '' ;
790791
791792 try {
792- $ bouncer ->safelyBounce ();
793+ $ bouncer ->run ();
793794 } catch (BouncerException $ e ) {
794795 $ error = $ e ->getMessage ();
795796 }
@@ -822,7 +823,7 @@ public function testSafelyBounce()
822823 $ error = '' ;
823824
824825 try {
825- $ bouncer ->safelyBounce ();
826+ $ bouncer ->run ();
826827 } catch (BouncerException $ e ) {
827828 $ error = $ e ->getMessage ();
828829 }
@@ -845,7 +846,7 @@ public function testSafelyBounce()
845846 ),
846847 $ this ->logger
847848 );
848- $ bouncer ->safelyBounce ();
849+ $ bouncer ->run ();
849850 PHPUnitUtil::assertRegExp (
850851 $ this ,
851852 '/.*100.*X-Forwarded-for usage is disabled/ ' ,
@@ -862,7 +863,7 @@ public function testSafelyBounce()
862863 ]
863864 ), $ this ->logger
864865 );
865- $ bouncer ->safelyBounce ();
866+ $ bouncer ->run ();
866867 PHPUnitUtil::assertRegExp (
867868 $ this ,
868869 '/.*100.*X-Forwarded-for usage is forced.*"x_forwarded_for_ip":"1.2.3.5"/ ' ,
@@ -877,7 +878,7 @@ public function testSafelyBounce()
877878 $ this ->configs
878879 ), $ this ->logger
879880 );
880- $ bouncer ->safelyBounce ();
881+ $ bouncer ->run ();
881882 PHPUnitUtil::assertRegExp (
882883 $ this ,
883884 '/.*300.*Detected IP is not allowed for X-Forwarded-for usage.*"x_forwarded_for_ip":"1.2.3.5"/ ' ,
@@ -892,7 +893,7 @@ public function testSafelyBounce()
892893 $ this ->configs
893894 ), $ this ->logger
894895 );
895- $ bouncer ->safelyBounce ();
896+ $ bouncer ->run ();
896897 PHPUnitUtil::assertRegExp (
897898 $ this ,
898899 '/.*100.*Detected IP is allowed for X-Forwarded-for usage.*"original_ip":"5.6.7.8","x_forwarded_for_ip":"127.0.0.10"/ ' ,
0 commit comments