‪TYPO3CMS  9.5
EditRecordViewHelperTest.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
5 
6 /*
7  * This file is part of the TYPO3 CMS project.
8  *
9  * It is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License, either version 2
11  * of the License, or any later version.
12  *
13  * For the full copyright and license information, please read the
14  * LICENSE.txt file that was distributed with this source code.
15  *
16  * The TYPO3 project - inspiring people to share!
17  */
18 
21 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
22 
26 class ‪EditRecordViewHelperTest extends FunctionalTestCase
27 {
32  {
33  $view = GeneralUtility::makeInstance(StandaloneView::class);
34  $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithUidAndTable.html');
35  $result = urldecode($view->render());
36 
37  $this->assertContains('route=/record/edit', $result);
38  $this->assertContains('edit[a_table][42]=edit', $result);
39  }
40 
45  {
46  $view = GeneralUtility::makeInstance(StandaloneView::class);
47  $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/InlineWithUidAndTable.html');
48  $result = urldecode($view->render());
49 
50  $this->assertContains('route=/record/edit', $result);
51  $this->assertContains('edit[b_table][21]=edit', $result);
52  }
53 
58  {
59  $view = GeneralUtility::makeInstance(StandaloneView::class);
60  $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithUidTableAndReturnUrl.html');
61  $result = urldecode($view->render());
62 
63  $this->assertContains('route=/record/edit', $result);
64  $this->assertContains('edit[c_table][43]=edit', $result);
65  $this->assertContains('returnUrl=foo/bar', $result);
66  }
67 
72  {
73  $this->expectException(\InvalidArgumentException::class);
74  $this->expectExceptionCode(1526128259);
75 
76  $view = GeneralUtility::makeInstance(StandaloneView::class);
77  $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/EditRecordViewHelper/WithNegativeUid.html');
78  $view->render();
79  }
80 }
‪TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri\EditRecordViewHelperTest
Definition: EditRecordViewHelperTest.php:27
‪TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri\EditRecordViewHelperTest\renderReturnsValidLinkInExplicitFormat
‪renderReturnsValidLinkInExplicitFormat()
Definition: EditRecordViewHelperTest.php:31
‪TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri
Definition: EditRecordViewHelperTest.php:4
‪TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri\EditRecordViewHelperTest\renderThrowsExceptionForInvalidUidArgument
‪renderThrowsExceptionForInvalidUidArgument()
Definition: EditRecordViewHelperTest.php:71
‪TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri\EditRecordViewHelperTest\renderReturnsValidLinkInInlineFormat
‪renderReturnsValidLinkInInlineFormat()
Definition: EditRecordViewHelperTest.php:44
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:32
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri\EditRecordViewHelperTest\renderReturnsValidLinkWithReturnUrl
‪renderReturnsValidLinkWithReturnUrl()
Definition: EditRecordViewHelperTest.php:57