TYPO3 CMS  TYPO3_7-6
AbstractPluginTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
18 
23 {
27  protected $abstractPlugin;
28 
32  protected $defaultPiVars;
33 
37  protected function setUp()
38  {
39  parent::setUp();
40 
41  // Allow objects until 100 levels deep when executing the stdWrap
42  $GLOBALS['TSFE'] = new \stdClass();
43  $GLOBALS['TSFE']->cObjectDepthCounter = 100;
44 
45  $this->abstractPlugin = new \TYPO3\CMS\Frontend\Plugin\AbstractPlugin();
46  $contentObjectRenderer = new ContentObjectRenderer();
47  $contentObjectRenderer->setContentObjectClassMap([
48  'TEXT' => TextContentObject::class,
49  ]);
50  $this->abstractPlugin->cObj = $contentObjectRenderer;
51  $this->defaultPiVars = $this->abstractPlugin->piVars;
52  }
53 
60  {
61  return [
62  'stdWrap on conf, non-recursive, stdWrap 1 level deep' => [
63  [
64  'abc' => 'DEF',
65  'abc.' => [
66  'stdWrap.' => [
67  'wrap' => 'test | test'
68  ],
69  ],
70  ],
71  [
72  'abc' => 'testDEFtest',
73  'pointer' => '',
74  'mode' => '',
75  'sword' => '',
76  'sort' => '',
77  ],
78  ],
79  'stdWrap on conf, non-recursive, stdWrap 2 levels deep' => [
80  [
81  'xyz.' => [
82  'stdWrap.' => [
83  'cObject' => 'TEXT',
84  'cObject.' => [
85  'data' => 'date:U',
86  'strftime' => '%Y',
87  ],
88  ],
89  ],
90  ],
91  [
92  'xyz' => date('Y'),
93  'pointer' => '',
94  'mode' => '',
95  'sword' => '',
96  'sort' => '',
97  ],
98  ],
99  'stdWrap on conf, recursive' => [
100  [
101  'abc.' => [
102  'def' => 'DEF',
103  'def.' => [
104  'ghi' => '123',
105  'stdWrap.' => [
106  'wrap' => 'test | test'
107  ],
108  ],
109  ],
110  ],
111  [
112  'abc.' => [
113  'def' => 'testDEFtest',
114  'def.' => [
115  'ghi' => '123',
116  ],
117  ],
118  'pointer' => '',
119  'mode' => '',
120  'sword' => '',
121  'sort' => '',
122  ],
123  ],
124  ];
125  }
126 
131  public function piSetPiVarDefaultsStdWrap($input, $expected)
132  {
133  $this->abstractPlugin->piVars = $this->defaultPiVars;
134 
135  $this->abstractPlugin->conf['_DEFAULT_PI_VARS.'] = $input;
136  $this->abstractPlugin->pi_setPiVarDefaults();
137  $this->assertEquals($expected, $this->abstractPlugin->piVars);
138  }
139 }
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']