function LinkGeneratorTest::testGenerateButton
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php \Drupal\Tests\Core\Utility\LinkGeneratorTest::testGenerateButton()
- 10 core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php \Drupal\Tests\Core\Utility\LinkGeneratorTest::testGenerateButton()
- 11.x core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php \Drupal\Tests\Core\Utility\LinkGeneratorTest::testGenerateButton()
Tests the generate() method with the <button> route.
@covers ::generate
File
-
core/
tests/ Drupal/ Tests/ Core/ Utility/ LinkGeneratorTest.php, line 208
Class
- LinkGeneratorTest
- @coversDefaultClass \Drupal\Core\Utility\LinkGenerator @group Utility
Namespace
Drupal\Tests\Core\UtilityCode
public function testGenerateButton() {
$this->urlGenerator
->expects($this->never())
->method('generateFromRoute');
$this->moduleHandler
->expects($this->once())
->method('alter')
->with('link', $this->isType('array'));
$url = Url::fromRoute('<button>');
$url->setUrlGenerator($this->urlGenerator);
$result = $this->linkGenerator
->generate('Test', $url);
$this->assertInstanceOf(GeneratedButton::class, $result);
$this->assertSame('<button type="button">Test</button>', (string) $result);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.