You are here

public function UnBanIpTest::testActionExecutionWithContextIpv6 in Rules 8.3

Tests the action execution with Context IPv6.

Uses the 192.0.2.0/24 "TEST-NET" address block as defined in RFC3330.

@covers ::execute

See also

http://en.wikipedia.org/wiki/Reserved_IP_addresses

https://tools.ietf.org/html/rfc3330

File

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

Class

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

Namespace

Drupal\Tests\rules\Unit\Integration\RulesAction

Code

public function testActionExecutionWithContextIpv6() {

  // TEST-NET-1 IPv4 '192.0.2.0' converted to IPv6.
  $ipv6 = '2002:0:0:0:0:0:c000:200';
  $this->action
    ->setContextValue('ip', $ipv6);
  $this->banManager
    ->unbanIp($ipv6)
    ->shouldBeCalledTimes(1);
  $this->action
    ->execute();
  $this->logger
    ->notice('Removed ban on IP address %ip', [
    '%ip' => $ipv6,
  ])
    ->shouldHaveBeenCalled();
}