function BanIpTest::testActionExecutionWithContextIpv4
Tests the action execution with Context IPv4.
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 94
Class
- BanIpTest
- @coversDefaultClass \Drupal\rules\Plugin\RulesAction\BanIp @group RulesAction
Namespace
Drupal\Tests\rules\Unit\Integration\RulesActionCode
public function testActionExecutionWithContextIpv4() {
// TEST-NET-1 IPv4.
$ipv4 = '192.0.2.0';
$this->action
->setContextValue('ip', $ipv4);
$this->banManager
->banIp($ipv4)
->shouldBeCalledTimes(1);
$this->action
->execute();
$this->logger
->notice('Banned IP address %ip', [
'%ip' => $ipv4,
])
->shouldHaveBeenCalled();
}