You are here

public function UnBanIpTest::testActionExecutionWithoutContextIp in Rules 8.3

Tests the action execution without Context IP set.

Should fallback to the current IP of the request.

@covers ::execute

File

tests/src/Unit/Integration/RulesAction/UnBanIpTest.php, line 135

Class

UnBanIpTest
@coversDefaultClass \Drupal\rules\Plugin\RulesAction\UnBanIp @group RulesAction

Namespace

Drupal\Tests\rules\Unit\Integration\RulesAction

Code

public function testActionExecutionWithoutContextIp() {

  // TEST-NET-1 IPv4.
  $ip = '192.0.2.0';
  $this->request
    ->getClientIp()
    ->willReturn($ip)
    ->shouldBeCalledTimes(1);
  $this->banManager
    ->unbanIp($ip)
    ->shouldBeCalledTimes(1);
  $this->action
    ->execute();
  $this->logger
    ->notice('Removed ban on IP address %ip', [
    '%ip' => $ip,
  ])
    ->shouldHaveBeenCalled();
}