public function ConfirmFormHelperTest::testCancelLinkRouteWithParams in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Form/ConfirmFormHelperTest.php \Drupal\Tests\Core\Form\ConfirmFormHelperTest::testCancelLinkRouteWithParams()
@covers ::buildCancelLink
Tests a cancel link route with parameters.
File
- core/
tests/ Drupal/ Tests/ Core/ Form/ ConfirmFormHelperTest.php, line 61 - Contains \Drupal\Tests\Core\Form\ConfirmFormHelperTest.
Class
- ConfirmFormHelperTest
- @coversDefaultClass \Drupal\Core\Form\ConfirmFormHelper @group Form
Namespace
Drupal\Tests\Core\FormCode
public function testCancelLinkRouteWithParams() {
$expected = Url::fromRoute('foo_bar.baz', [
'baz' => 'banana',
], [
'absolute' => TRUE,
]);
$form = $this
->getMock('Drupal\\Core\\Form\\ConfirmFormInterface');
$form
->expects($this
->any())
->method('getCancelUrl')
->will($this
->returnValue($expected));
$link = ConfirmFormHelper::buildCancelLink($form, new Request());
$this
->assertEquals($expected, $link['#url']);
$this
->assertSame([
'contexts' => [
'url.query_args:destination',
],
], $link['#cache']);
}