‪TYPO3CMS  9.5
CoreVersionServiceTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
17 use Prophecy\Argument;
22 use TYPO3\CMS\Install\Service\CoreVersionService;
23 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
24 
28 class ‪CoreVersionServiceTest extends UnitTestCase
29 {
33  protected ‪$resetSingletonInstances = true;
34 
39  {
40  $this->‪setUpApiResponse([
41  '7' => [],
42  '6.2' => []
43  ]);
45  $instance = $this->getAccessibleMock(CoreVersionService::class, ['getInstalledVersion']);
46  $registry = $this->createMock(Registry::class);
47  $registry
48  ->expects($this->once())
49  ->method('set')
50  ->with('TYPO3.CMS.Install', 'coreVersionMatrix', $this->logicalNot($this->arrayHasKey('6.2')));
51  $instance->expects($this->once())->method('getInstalledVersion')->will($this->returnValue('7.6.25'));
52  $instance->_set('registry', $registry);
53  $instance->updateVersionMatrix();
54  }
55 
56  public function ‪setUpApiResponse(array $responseData)
57  {
58  $response = new ‪JsonResponse($responseData);
59  $requestFactory = $this->prophesize(RequestFactory::class);
60  $requestFactory->request('https://get.typo3.org/json', Argument::cetera())->willReturn($response);
61  GeneralUtility::addInstance(RequestFactory::class, $requestFactory->reveal());
62  }
63 }
‪TYPO3\CMS\Core\Registry
Definition: Registry.php:32
‪TYPO3\CMS\Core\Http\RequestFactory
Definition: RequestFactory.php:27
‪TYPO3\CMS\Install\Tests\UnitDeprecated\Service
Definition: CoreVersionServiceTest.php:2
‪TYPO3\CMS\Core\Http\JsonResponse
Definition: JsonResponse.php:25
‪TYPO3\CMS\Install\Tests\UnitDeprecated\Service\CoreVersionServiceTest\$resetSingletonInstances
‪bool $resetSingletonInstances
Definition: CoreVersionServiceTest.php:32
‪TYPO3\CMS\Install\Tests\UnitDeprecated\Service\CoreVersionServiceTest\setUpApiResponse
‪setUpApiResponse(array $responseData)
Definition: CoreVersionServiceTest.php:55
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Install\Tests\UnitDeprecated\Service\CoreVersionServiceTest\updateVersionMatrixRemovesOldReleasesFromMatrix
‪updateVersionMatrixRemovesOldReleasesFromMatrix()
Definition: CoreVersionServiceTest.php:37
‪TYPO3\CMS\Install\Tests\UnitDeprecated\Service\CoreVersionServiceTest
Definition: CoreVersionServiceTest.php:29