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