[TASK] Remove TYPO3_DB from Tests
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Tests / Unit / Updates / ContentTypesToTextMediaUpdateTest.php
1 <?php
2 namespace TYPO3\CMS\Install\Tests\Unit\Updates;
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\Prophecy\ObjectProphecy;
18 use Prophecy\Prophet;
19 use TYPO3\CMS\Core\Package\PackageManager;
20 use TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase;
21 use TYPO3\CMS\Core\Tests\Unit\Utility\AccessibleProxies\ExtensionManagementUtilityAccessibleProxy;
22 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
23 use TYPO3\CMS\Install\Updates\ContentTypesToTextMediaUpdate as UpdateWizard;
24
25 /**
26 * Test Class for ContentTypesToTextMediaUpdate
27 */
28 class ContentTypesToTextMediaUpdateTest extends BaseTestCase
29 {
30 /**
31 * @var PackageManager|ObjectProphecy
32 */
33 protected $packageManagerProphecy;
34
35 /**
36 * @var ObjectProphecy
37 */
38 protected $dbProphecy;
39
40 /**
41 * @var \TYPO3\CMS\Core\Package\PackageManager
42 */
43 protected $backupPackageManager;
44
45 /**
46 * @var ObjectProphecy
47 */
48 protected $updateWizard;
49
50 /**
51 * Set up
52 */
53 public function setUp()
54 {
55 unset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']);
56 $prophet = new Prophet();
57 $this->packageManagerProphecy = $prophet->prophesize(PackageManager::class);
58 $this->updateWizard = new UpdateWizard();
59 $this->backupPackageManager = ExtensionManagementUtilityAccessibleProxy::getPackageManager();
60 ExtensionManagementUtility::setPackageManager($this->packageManagerProphecy->reveal());
61 }
62
63 /**
64 * Tear down
65 */
66 public function tearDown()
67 {
68 ExtensionManagementUtilityAccessibleProxy::setPackageManager($this->backupPackageManager);
69 parent::tearDown();
70 }
71
72 /**
73 * @test
74 * @return void
75 */
76 public function updateWizardDoesNotRunIfCssStyledContentIsInstalled()
77 {
78 $this->packageManagerProphecy->isPackageActive('fluid_styled_content')->willReturn(true);
79 $this->packageManagerProphecy->isPackageActive('css_styled_content')->willReturn(true);
80
81 $description = '';
82 $this->assertFalse($this->updateWizard->checkForUpdate($description));
83 }
84 }