02362d7f95a603fefed7ff22f277586cdcc4c0c3
[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->dbProphecy = $prophet->prophesize(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
59 $GLOBALS['TYPO3_DB'] = $this->dbProphecy->reveal();
60 $this->updateWizard = new UpdateWizard();
61 $this->backupPackageManager = ExtensionManagementUtilityAccessibleProxy::getPackageManager();
62 ExtensionManagementUtility::setPackageManager($this->packageManagerProphecy->reveal());
63 }
64
65 /**
66 * Tear down
67 */
68 public function tearDown()
69 {
70 ExtensionManagementUtilityAccessibleProxy::setPackageManager($this->backupPackageManager);
71 parent::tearDown();
72 }
73
74 /**
75 * @test
76 * @return void
77 */
78 public function updateWizardDoesNotRunIfCssStyledContentIsInstalled()
79 {
80 $this->packageManagerProphecy->isPackageActive('fluid_styled_content')->willReturn(true);
81 $this->packageManagerProphecy->isPackageActive('css_styled_content')->willReturn(true);
82
83 $description = '';
84 $this->assertFalse($this->updateWizard->checkForUpdate($description));
85 }
86 }