‪TYPO3CMS  9.5
NewRecordViewHelperTest.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 ‪NewRecordViewHelperTest extends FunctionalTestCase
27 {
32  {
33  $view = GeneralUtility::makeInstance(StandaloneView::class);
34  $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPidAndTable.html');
35  $result = urldecode($view->render());
36 
37  $this->assertContains('route=/record/edit', $result);
38  $this->assertContains('edit[a_table][17]=new', $result);
39  }
40 
45  {
46  $view = GeneralUtility::makeInstance(StandaloneView::class);
47  $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithTable.html');
48  $result = urldecode($view->render());
49 
50  $this->assertContains('route=/record/edit', $result);
51  $this->assertContains('edit[a_table][0]=new', $result);
52  }
53 
58  {
59  $view = GeneralUtility::makeInstance(StandaloneView::class);
60  $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/InlineWithPidAndTable.html');
61  $result = urldecode($view->render());
62 
63  $this->assertContains('route=/record/edit', $result);
64  $this->assertContains('edit[b_table][17]=new', $result);
65  }
66 
71  {
72  $view = GeneralUtility::makeInstance(StandaloneView::class);
73  $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPidTableAndReturnUrl.html');
74  $result = urldecode($view->render());
75 
76  $this->assertContains('route=/record/edit', $result);
77  $this->assertContains('edit[c_table][17]=new', $result);
78  $this->assertContains('returnUrl=foo/bar', $result);
79  }
80 
85  {
86  $view = GeneralUtility::makeInstance(StandaloneView::class);
87  $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithNegativeUid.html');
88  $result = urldecode($view->render());
89 
90  $this->assertContains('route=/record/edit', $result);
91  $this->assertContains('edit[c_table][-11]=new', $result);
92  }
93 
98  {
99  $this->expectException(\InvalidArgumentException::class);
100  $this->expectExceptionCode(1526136338);
101 
102  $view = GeneralUtility::makeInstance(StandaloneView::class);
103  $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithUidAndPid.html');
104  $view->render();
105  }
106 
111  {
112  $this->expectException(\InvalidArgumentException::class);
113  $this->expectExceptionCode(1526136362);
114 
115  $view = GeneralUtility::makeInstance(StandaloneView::class);
116  $view->setTemplatePathAndFilename('EXT:backend/Tests/Functional/ViewHelpers/Fixtures/Uri/NewRecordViewHelper/WithPositiveUid.html');
117  $view->render();
118  }
119 }
‪TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri\NewRecordViewHelperTest\renderReturnsValidLinkWitPosition
‪renderReturnsValidLinkWitPosition()
Definition: NewRecordViewHelperTest.php:84
‪TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri\NewRecordViewHelperTest\renderReturnsValidLinkInExplicitFormat
‪renderReturnsValidLinkInExplicitFormat()
Definition: NewRecordViewHelperTest.php:31
‪TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri\NewRecordViewHelperTest
Definition: NewRecordViewHelperTest.php:27
‪TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri\NewRecordViewHelperTest\renderThrowsExceptionForInvalidUidArgument
‪renderThrowsExceptionForInvalidUidArgument()
Definition: NewRecordViewHelperTest.php:110
‪TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri
Definition: EditRecordViewHelperTest.php:4
‪TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri\NewRecordViewHelperTest\renderReturnsValidLinkForRoot
‪renderReturnsValidLinkForRoot()
Definition: NewRecordViewHelperTest.php:44
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:32
‪TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri\NewRecordViewHelperTest\renderReturnsValidLinkWithReturnUrl
‪renderReturnsValidLinkWithReturnUrl()
Definition: NewRecordViewHelperTest.php:70
‪TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri\NewRecordViewHelperTest\renderReturnsValidLinkInInlineFormat
‪renderReturnsValidLinkInInlineFormat()
Definition: NewRecordViewHelperTest.php:57
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri\NewRecordViewHelperTest\renderThrowsExceptionForUidAndPid
‪renderThrowsExceptionForUidAndPid()
Definition: NewRecordViewHelperTest.php:97