‪TYPO3CMS  9.5
Compatibility7ExtractionUpdateTest.php
Go to the documentation of this file.
1 <?php
2 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 
24 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
25 
29 class ‪Compatibility7ExtractionUpdateTest extends UnitTestCase
30 {
34  protected ‪$registry;
35 
39  protected function ‪setUp()
40  {
41  $this->registry = $this->prophesize(Registry::class);
42  GeneralUtility::setSingletonInstance(Registry::class, $this->registry->reveal());
43  }
44 
48  protected function ‪tearDown()
49  {
50  GeneralUtility::purgeInstances();
51  parent::tearDown();
52  }
53 
58  {
59  $this->registry->get('installUpdate', Compatibility7ExtractionUpdate::class, false)->willReturn(false);
60  $subject = new ‪Compatibility7ExtractionUpdate();
61  $this->assertTrue($subject->updateNecessary());
62  }
63 
68  {
69  $objectManager = $this->prophesize(ObjectManager::class);
70  GeneralUtility::setSingletonInstance(ObjectManager::class, $objectManager->reveal());
71 
72  $listUtility = $this->prophesize(ListUtility::class);
73  $installUtility = $this->prophesize(InstallUtility::class);
74  $objectManager->get(InstallUtility::class)->willReturn($installUtility->reveal());
75  $objectManager->get(ListUtility::class)->willReturn($listUtility->reveal());
76  $extensionList = ['compatibility7' => ['foo' => 'bar']];
77  $listUtility->getAvailableExtensions()->willReturn($extensionList);
78  $listUtility->getAvailableAndInstalledExtensions($extensionList)->willReturn($extensionList);
79 
80  $subject = new ‪Compatibility7ExtractionUpdate();
81  $this->assertTrue($subject->executeUpdate());
82 
83  $installUtility->install('compatibility7')->shouldHaveBeenCalled();
84  }
85 }
‪TYPO3\CMS\Install\Tests\Unit\Updates\Compatibility7ExtractionUpdateTest
Definition: Compatibility7ExtractionUpdateTest.php:30
‪TYPO3\CMS\Install\Tests\Unit\Updates\Compatibility7ExtractionUpdateTest\performUpdateInstallsExtensionUponRequest
‪performUpdateInstallsExtensionUponRequest()
Definition: Compatibility7ExtractionUpdateTest.php:66
‪TYPO3\CMS\Install\Tests\Unit\Updates\Compatibility7ExtractionUpdateTest\tearDown
‪tearDown()
Definition: Compatibility7ExtractionUpdateTest.php:47
‪TYPO3\CMS\Install\Tests\Unit\Updates
Definition: Compatibility7ExtractionUpdateTest.php:3
‪TYPO3\CMS\Core\Registry
Definition: Registry.php:32
‪TYPO3\CMS\Install\Updates\Compatibility7ExtractionUpdate
Definition: Compatibility7ExtractionUpdate.php:24
‪TYPO3\CMS\Extensionmanager\Utility\ListUtility
Definition: ListUtility.php:35
‪TYPO3\CMS\Extensionmanager\Utility\InstallUtility
Definition: InstallUtility.php:32
‪TYPO3\CMS\Install\Tests\Unit\Updates\Compatibility7ExtractionUpdateTest\$registry
‪Registry $registry
Definition: Compatibility7ExtractionUpdateTest.php:33
‪TYPO3\CMS\Install\Tests\Unit\Updates\Compatibility7ExtractionUpdateTest\setUp
‪setUp()
Definition: Compatibility7ExtractionUpdateTest.php:38
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Extbase\Object\ObjectManager
Definition: ObjectManager.php:25
‪TYPO3\CMS\Install\Tests\Unit\Updates\Compatibility7ExtractionUpdateTest\checkForUpdateReturnsTrueIfWizardIsNotMarkedAsDoneYet
‪checkForUpdateReturnsTrueIfWizardIsNotMarkedAsDoneYet()
Definition: Compatibility7ExtractionUpdateTest.php:56