‪TYPO3CMS  9.5
FrontendWorkspaceRestrictionTest.php
Go to the documentation of this file.
1 <?php
2 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 
24 {
25  protected ‪$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  $this->assertSame('("aTable"."t3ver_state" <= 0) AND ("aTable"."pid" <> -1)', (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  $this->assertSame('(("aTable"."t3ver_wsid" = 0) OR ("aTable"."t3ver_wsid" = 42)) AND ("aTable"."pid" <> -1)', (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  $this->assertSame('("aTable"."t3ver_wsid" = 0) OR ("aTable"."t3ver_wsid" = 42)', (string)$expression);
79  }
80 }
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\FrontendWorkspaceRestrictionTest
Definition: FrontendWorkspaceRestrictionTest.php:24
‪TYPO3\CMS\Core\Database\Query\Restriction\FrontendWorkspaceRestriction
Definition: FrontendWorkspaceRestriction.php:28
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction
Definition: AbstractRestrictionContainerTest.php:3
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\AbstractRestrictionTestCase
Definition: AbstractRestrictionTestCase.php:26
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\FrontendWorkspaceRestrictionTest\$resetSingletonInstances
‪$resetSingletonInstances
Definition: FrontendWorkspaceRestrictionTest.php:25
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\FrontendWorkspaceRestrictionTest\buildExpressionAddsLiveWorkspaceWhereClause
‪buildExpressionAddsLiveWorkspaceWhereClause()
Definition: FrontendWorkspaceRestrictionTest.php:30
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\FrontendWorkspaceRestrictionTest\buildExpressionAddsNonLiveWorkspaceExclusiveWhereClause
‪buildExpressionAddsNonLiveWorkspaceExclusiveWhereClause()
Definition: FrontendWorkspaceRestrictionTest.php:66
‪TYPO3\CMS\Core\Tests\Unit\Database\Query\Restriction\FrontendWorkspaceRestrictionTest\buildExpressionAddsNonLiveWorkspaceWhereClause
‪buildExpressionAddsNonLiveWorkspaceWhereClause()
Definition: FrontendWorkspaceRestrictionTest.php:48
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5