‪TYPO3CMS  10.4
UpgradeControllerTest.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 
20 use Psr\Http\Message\ServerRequestInterface;
23 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
24 
28 class ‪UpgradeControllerTest extends UnitTestCase
29 {
33  public function ‪versionDataProvider(): array
34  {
35  return [
36  ['master', false],
37  ['1.0', false],
38  ['1.10', false],
39  ['2.3.4', false],
40  ['2.3.20', false],
41  ['7.6.x', false],
42  ['10.0', false],
43  ['10.10', false],
44  ['10.10.5', false],
45  ['10.10.husel', true],
46  ['1.2.3.4', true],
47  ['9.8.x.x', true],
48  ['a.b.c', true],
49  ['4.3.x.1', true],
50  ['../../../../../../../etc/passwd', true],
51  ['husel', true],
52  ];
53  }
54 
61  public function ‪versionIsAsserted(string $version, bool $expectsException): void
62  {
63  if ($expectsException) {
64  $this->expectException(\InvalidArgumentException::class);
65  $this->expectExceptionCode(1537209128);
66  }
67  $requestProphecy = $this->prophesize(ServerRequestInterface::class);
68  $requestProphecy->getQueryParams()->willReturn([
69  'install' => [
70  'version' => $version,
71  ],
72  ]);
73 
75  $subject = $this->getMockBuilder(UpgradeController::class)
76  ->disableOriginalConstructor()
77  ->setMethods(['getDocumentationFiles', 'initializeStandaloneView'])
78  ->getMock();
79 
80  $subject->expects(self::any())->method('getDocumentationFiles')->willReturn([
81  'normalFiles' => [],
82  'readFiles' => [],
83  'notAffectedFiles' => [],
84  ]);
85  $subject->expects(self::any())
86  ->method('initializeStandaloneView')
87  ->willReturn($this->prophesize(StandaloneView::class)->reveal());
88  $subject->upgradeDocsGetChangelogForVersionAction($requestProphecy->reveal());
89  }
90 }
‪TYPO3\CMS\Install\Controller\UpgradeController
Definition: UpgradeController.php:80
‪TYPO3\CMS\Install\Tests\Unit\Controller\UpgradeControllerTest\versionIsAsserted
‪versionIsAsserted(string $version, bool $expectsException)
Definition: UpgradeControllerTest.php:61
‪TYPO3\CMS\Install\Tests\Unit\Controller\UpgradeControllerTest\versionDataProvider
‪array versionDataProvider()
Definition: UpgradeControllerTest.php:33
‪TYPO3\CMS\Install\Tests\Unit\Controller\UpgradeControllerTest
Definition: UpgradeControllerTest.php:29
‪TYPO3\CMS\Fluid\View\StandaloneView
Definition: StandaloneView.php:34
‪TYPO3\CMS\Install\Tests\Unit\Controller
Definition: UpgradeControllerTest.php:18