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