function BanIpTest::testActionExecutionWithContextIpv6
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/ BanIpTest.php, line 116
Class
- BanIpTest
- @coversDefaultClass \Drupal\rules\Plugin\RulesAction\BanIp @group RulesAction
Namespace
Drupal\Tests\rules\Unit\Integration\RulesActionCode
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
->banIp($ipv6)
->shouldBeCalledTimes(1);
$this->action
->execute();
$this->logger
->notice('Banned IP address %ip', [
'%ip' => $ipv6,
])
->shouldHaveBeenCalled();
}