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