‪TYPO3CMS  10.4
RelationHandlerTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 
24 class ‪RelationHandlerTest extends UnitTestCase
25 {
29  protected ‪$subject;
30 
31  protected function ‪setUp(): void
32  {
33  parent::setUp();
34  $this->subject = $this->getMockBuilder(RelationHandler::class)
35  ->setMethods(['purgeVersionedIds', 'purgeLiveVersionedIds'])
36  ->getMock();
37  }
38 
43  {
44  ‪$GLOBALS['TCA']['sys_category']['ctrl']['versioningWS'] = false;
45 
46  $this->subject->tableArray = [
47  'sys_category' => [1, 2, 3],
48  ];
49 
50  self::assertFalse($this->subject->purgeItemArray(0));
51  }
52 
57  {
58  ‪$GLOBALS['TCA']['sys_category']['ctrl']['versioningWS'] = true;
59 
60  $this->subject->tableArray = [
61  'sys_category' => [1, 2, 3],
62  ];
63 
64  $this->subject->expects(self::once())
65  ->method('purgeVersionedIds')
66  ->with('sys_category', [1, 2, 3])
67  ->willReturn([2]);
68 
69  self::assertTrue($this->subject->purgeItemArray(0));
70  }
71 }
‪TYPO3\CMS\Core\Database\RelationHandler
Definition: RelationHandler.php:35
‪TYPO3\CMS\Core\Tests\Unit\Database\RelationHandlerTest\purgeItemArrayReturnsFalseIfVersioningForTableIsDisabled
‪purgeItemArrayReturnsFalseIfVersioningForTableIsDisabled()
Definition: RelationHandlerTest.php:41
‪TYPO3\CMS\Core\Tests\Unit\Database
Definition: ConnectionPoolTest.php:18
‪TYPO3\CMS\Core\Tests\Unit\Database\RelationHandlerTest\setUp
‪setUp()
Definition: RelationHandlerTest.php:30
‪TYPO3\CMS\Core\Tests\Unit\Database\RelationHandlerTest
Definition: RelationHandlerTest.php:25
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Tests\Unit\Database\RelationHandlerTest\purgeItemArrayReturnsTrueIfItemsHaveBeenPurged
‪purgeItemArrayReturnsTrueIfItemsHaveBeenPurged()
Definition: RelationHandlerTest.php:55
‪TYPO3\CMS\Core\Tests\Unit\Database\RelationHandlerTest\$subject
‪TYPO3 CMS Core Database RelationHandler $subject
Definition: RelationHandlerTest.php:28