function BanAdminTest::testRouteParameter
Same name in other branches
- 10 core/modules/ban/tests/src/Unit/BanAdminTest.php \Drupal\Tests\ban\Unit\BanAdminTest::testRouteParameter()
Test passing an IP address as a route parameter.
@covers ::buildForm
File
-
core/
modules/ ban/ tests/ src/ Unit/ BanAdminTest.php, line 93
Class
- BanAdminTest
- Tests the BanAdmin form.
Namespace
Drupal\Tests\ban\UnitCode
public function testRouteParameter() : void {
$ip = '1.2.3.4';
$formObject = new BanAdmin($this->getIpManagerMock());
$formObject->setStringTranslation($this->getStringTranslationStub());
$formState = $this->createMock(FormStateInterface::class);
$form = $formObject->buildForm([], $formState, $ip);
$this->assertSame($ip, $form['ip']['#default_value']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.