public function ConfirmFormHelperTest::testCancelLinkTitle in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Form/ConfirmFormHelperTest.php \Drupal\Tests\Core\Form\ConfirmFormHelperTest::testCancelLinkTitle()
- 9 core/tests/Drupal/Tests/Core/Form/ConfirmFormHelperTest.php \Drupal\Tests\Core\Form\ConfirmFormHelperTest::testCancelLinkTitle()
@covers ::buildCancelLink
Tests the cancel link title.
File
- core/
tests/ Drupal/ Tests/ Core/ Form/ ConfirmFormHelperTest.php, line 22
Class
- ConfirmFormHelperTest
- @coversDefaultClass \Drupal\Core\Form\ConfirmFormHelper @group Form
Namespace
Drupal\Tests\Core\FormCode
public function testCancelLinkTitle() {
$cancel_text = 'Cancel text';
$form = $this
->createMock('Drupal\\Core\\Form\\ConfirmFormInterface');
$form
->expects($this
->any())
->method('getCancelText')
->will($this
->returnValue($cancel_text));
$link = ConfirmFormHelper::buildCancelLink($form, new Request());
$this
->assertSame($cancel_text, $link['#title']);
$this
->assertSame([
'contexts' => [
'url.query_args:destination',
],
], $link['#cache']);
}