‪TYPO3CMS  ‪main
IndexedSearchCTypeMigrationTest.php
Go to the documentation of this file.
1 <?php
2 
3 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 
19 
20 use PHPUnit\Framework\Attributes\Test;
25 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
26 
27 final class ‪IndexedSearchCTypeMigrationTest extends FunctionalTestCase
28 {
29  protected const ‪TABLE_CONTENT = 'tt_content';
30  protected const ‪TABLE_BACKEND_USER_GROUPS = 'be_groups';
31 
32  protected string ‪$baseDataSet = __DIR__ . '/Fixtures/IndexedSearchBase.csv';
33  protected string ‪$fullMigrationResultDataSet = __DIR__ . '/Fixtures/IndexedSearchMigrated.csv';
34  protected string ‪$partiallyMigrationResultDataSet = __DIR__ . '/Fixtures/IndexedSearchPartiallyMigrated.csv';
35 
36  #[Test]
38  {
39  $registryMock = $this->createMock(Registry::class);
40  $registryMock
41  ->method('get')
42  ->with('installUpdate', BackendGroupsExplicitAllowDenyMigration::class, false)
43  ->willReturn(true);
44 
45  $subject = new ‪IndexedSearchCTypeMigration($registryMock, $this->get(ConnectionPool::class));
46 
47  $this->importCSVDataSet($this->baseDataSet);
48  self::assertTrue($subject->updateNecessary());
49  $subject->executeUpdate();
50  self::assertFalse($subject->updateNecessary());
51  $this->assertCSVDataSet($this->fullMigrationResultDataSet);
52 
53  // Just ensure that running the upgrade again does not change anything
54  $subject->executeUpdate();
55  $this->assertCSVDataSet($this->fullMigrationResultDataSet);
56  }
57 
58  #[Test]
59  public function ‪backendUserGroupsNotUpdated(): void
60  {
61  $registryMock = $this->createMock(Registry::class);
62  $registryMock
63  ->method('get')
64  ->with('installUpdate', BackendGroupsExplicitAllowDenyMigration::class, false)
65  ->willReturn(false);
66 
67  $subject = new ‪IndexedSearchCTypeMigration($registryMock, $this->get(ConnectionPool::class));
68 
69  $this->importCSVDataSet($this->baseDataSet);
70  self::assertTrue($subject->updateNecessary());
71  $subject->executeUpdate();
72  self::assertFalse($subject->updateNecessary());
73  $this->assertCSVDataSet($this->partiallyMigrationResultDataSet);
74 
75  // Just ensure that running the upgrade again does not change anything
76  $subject->executeUpdate();
77  $this->assertCSVDataSet($this->partiallyMigrationResultDataSet);
78  }
79 }
‪TYPO3\CMS\Install\Updates\IndexedSearchCTypeMigration
Definition: IndexedSearchCTypeMigration.php:33
‪TYPO3\CMS\Install\Tests\Functional\Updates\IndexedSearchCTypeMigrationTest\backendUserGroupsNotUpdated
‪backendUserGroupsNotUpdated()
Definition: IndexedSearchCTypeMigrationTest.php:59
‪TYPO3\CMS\Install\Updates\BackendGroupsExplicitAllowDenyMigration
Definition: BackendGroupsExplicitAllowDenyMigration.php:33
‪TYPO3\CMS\Core\Registry
Definition: Registry.php:33
‪TYPO3\CMS\Install\Tests\Functional\Updates\IndexedSearchCTypeMigrationTest\TABLE_CONTENT
‪const TABLE_CONTENT
Definition: IndexedSearchCTypeMigrationTest.php:29
‪TYPO3\CMS\Install\Tests\Functional\Updates\IndexedSearchCTypeMigrationTest\contentElementsAndBackendUserGroupsUpdated
‪contentElementsAndBackendUserGroupsUpdated()
Definition: IndexedSearchCTypeMigrationTest.php:37
‪TYPO3\CMS\Install\Tests\Functional\Updates\IndexedSearchCTypeMigrationTest\$fullMigrationResultDataSet
‪string $fullMigrationResultDataSet
Definition: IndexedSearchCTypeMigrationTest.php:33
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:46
‪TYPO3\CMS\Install\Tests\Functional\Updates
Definition: BackendGroupsExplicitAllowDenyMigrationTest.php:18
‪TYPO3\CMS\Install\Tests\Functional\Updates\IndexedSearchCTypeMigrationTest\$partiallyMigrationResultDataSet
‪string $partiallyMigrationResultDataSet
Definition: IndexedSearchCTypeMigrationTest.php:34
‪TYPO3\CMS\Install\Tests\Functional\Updates\IndexedSearchCTypeMigrationTest\TABLE_BACKEND_USER_GROUPS
‪const TABLE_BACKEND_USER_GROUPS
Definition: IndexedSearchCTypeMigrationTest.php:30
‪TYPO3\CMS\Install\Tests\Functional\Updates\IndexedSearchCTypeMigrationTest\$baseDataSet
‪string $baseDataSet
Definition: IndexedSearchCTypeMigrationTest.php:32
‪TYPO3\CMS\Install\Tests\Functional\Updates\IndexedSearchCTypeMigrationTest
Definition: IndexedSearchCTypeMigrationTest.php:28