‪TYPO3CMS  10.4
FrontendWorkspaceRestrictionTest.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 
21 
26 {
27  protected ‪$resetSingletonInstances = true;
28 
33  {
34  ‪$GLOBALS['TCA'] = [
35  'aTable' => [
36  'ctrl' => [
37  'versioningWS' => true,
38  ],
39  ]
40  ];
41 
42  $subject = new ‪FrontendWorkspaceRestriction(0);
43  $expression = $subject->buildExpression(['aTable' => 'aTable'], $this->expressionBuilder);
44  self::assertSame('("aTable"."t3ver_state" <= 0) AND ("aTable"."t3ver_oid" = 0)', (string)$expression);
45  }
46 
51  {
52  ‪$GLOBALS['TCA'] = [
53  'aTable' => [
54  'ctrl' => [
55  'versioningWS' => true,
56  ],
57  ]
58  ];
59 
60  $subject = new ‪FrontendWorkspaceRestriction(42, true);
61  $expression = $subject->buildExpression(['aTable' => 'aTable'], $this->expressionBuilder);
62  self::assertSame('(("aTable"."t3ver_wsid" = 0) OR ("aTable"."t3ver_wsid" = 42)) AND ("aTable"."t3ver_oid" = 0)', (string)$expression);
63  }
64 
69  {
70  ‪$GLOBALS['TCA'] = [
71  'aTable' => [
72  'ctrl' => [
73  'versioningWS' => true,
74  ],
75  ]
76  ];
77 
78  $subject = new ‪FrontendWorkspaceRestriction(42, true, false);
79  $expression = $subject->buildExpression(['aTable' => 'aTable'], $this->expressionBuilder);
80  self::assertSame('("aTable"."t3ver_wsid" = 0) OR ("aTable"."t3ver_wsid" = 42)', (string)$expression);
81  }
82 }
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\FrontendWorkspaceRestrictionTest
Definition: FrontendWorkspaceRestrictionTest.php:26
‪TYPO3\CMS\Core\Database\Query\Restriction\FrontendWorkspaceRestriction
Definition: FrontendWorkspaceRestriction.php:30
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction
Definition: AbstractRestrictionContainerTest.php:18
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\AbstractRestrictionTestCase
Definition: AbstractRestrictionTestCase.php:28
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\FrontendWorkspaceRestrictionTest\$resetSingletonInstances
‪$resetSingletonInstances
Definition: FrontendWorkspaceRestrictionTest.php:27
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\FrontendWorkspaceRestrictionTest\buildExpressionAddsLiveWorkspaceWhereClause
‪buildExpressionAddsLiveWorkspaceWhereClause()
Definition: FrontendWorkspaceRestrictionTest.php:32
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\FrontendWorkspaceRestrictionTest\buildExpressionAddsNonLiveWorkspaceExclusiveWhereClause
‪buildExpressionAddsNonLiveWorkspaceExclusiveWhereClause()
Definition: FrontendWorkspaceRestrictionTest.php:68
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\FrontendWorkspaceRestrictionTest\buildExpressionAddsNonLiveWorkspaceWhereClause
‪buildExpressionAddsNonLiveWorkspaceWhereClause()
Definition: FrontendWorkspaceRestrictionTest.php:50
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5