TYPO3  7.6
ContentTypesToTextMediaUpdateTest.php
Go to the documentation of this file.
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\Argument;
18 use Prophecy\Prophecy\ObjectProphecy;
19 use Prophecy\Prophet;
20 use TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase;
24 
28 class ContentTypesToTextMediaUpdateTest extends BaseTestCase
29 {
34 
38  protected $dbProphecy;
39 
43  protected $updateWizard;
44 
45  public function setUp()
46  {
47  unset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']);
48  $prophet = new Prophet();
49  $this->packageManagerProphecy = $prophet->prophesize(PackageManager::class);
50  $this->dbProphecy = $prophet->prophesize(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
51  $GLOBALS['TYPO3_DB'] = $this->dbProphecy->reveal();
52  $this->updateWizard = new UpdateWizard();
53  ExtensionManagementUtility::setPackageManager($this->packageManagerProphecy->reveal());
54  }
55 
56  public function tearDown()
57  {
59  }
60 
66  {
67  $this->packageManagerProphecy->isPackageActive('fluid_styled_content')->willReturn(true);
68  $this->packageManagerProphecy->isPackageActive('css_styled_content')->willReturn(true);
69 
70  $description = '';
71  $this->assertFalse($this->updateWizard->checkForUpdate($description));
72  }
73 
79  {
80  $this->packageManagerProphecy->isPackageActive('fluid_styled_content')->willReturn(true);
81  $this->packageManagerProphecy->isPackageActive('css_styled_content')->willReturn(false);
82  $this->dbProphecy->exec_SELECTcountRows(Argument::cetera())->willReturn(1);
83 
84  $description = '';
85  $this->assertTrue($this->updateWizard->checkForUpdate($description));
86  }
87 }