31 $this->fixture = new \TYPO3\CMS\Backend\Form\ElementConditionMatcher();
46 'Invalid condition string' => array(
52 'Not loaded extension compares to loaded as FALSE' => array(
53 'EXT:neverloadedext:LOADED:TRUE',
58 'Not loaded extension compares to not loaded as TRUE' => array(
59 'EXT:neverloadedext:LOADED:FALSE',
64 'Loaded extension compares to TRUE' => array(
65 'EXT:backend:LOADED:TRUE',
70 'Loaded extension compares to FALSE' => array(
71 'EXT:backend:LOADED:FALSE',
76 'Field is not greater zero if not given' => array(
82 'Field is not equal 0 if not given' => array(
88 'Field value string comparison' => array(
90 array(
'foo' =>
'bar'),
94 'Field value comparison of 1 against multi-value field of 5 returns true' => array(
95 'FIELD:content:BIT:1',
96 array(
'content' =>
'5'),
100 'Field value comparison of 2 against multi-value field of 5 returns false' => array(
101 'FIELD:content:BIT:2',
102 array(
'content' =>
'5'),
106 'Field value of 5 negated comparison against multi-value field of 5 returns false' => array(
107 'FIELD:content:!BIT:5',
108 array(
'content' =>
'5'),
112 'Field value comparison for required value is false for different value' => array(
113 'FIELD:foo:REQ:FALSE',
114 array(
'foo' =>
'bar'),
118 'Field value string not equal comparison' => array(
120 array(
'foo' =>
'bar'),
124 'Field value in range' => array(
126 array(
'uid' =>
'23'),
130 'Field value greater than' => array(
132 array(
'uid' =>
'23'),
136 'Flexform value invalid comparison' => array(
146 'Flexform value valid comparison' => array(
147 'FIELD:parentRec.foo:=:bar',
149 'parentRec' => array(
156 'Field is value for default language without flexform' => array(
157 'HIDE_L10N_SIBLINGS',
162 'Field is value for default language with flexform' => array(
163 'HIDE_L10N_SIBLINGS',
168 'Field is value for default language with sibling' => array(
169 'HIDE_L10N_SIBLINGS',
174 'New is TRUE for new comparison with TRUE' => array(
176 array(
'uid' => NULL),
180 'New is FALSE for new comparison with FALSE' => array(
182 array(
'uid' => NULL),
186 'New is FALSE for not new element' => array(
192 'New is TRUE for not new element compared to FALSE' => array(
198 'Version is TRUE for versioned row' => array(
207 'Version is TRUE for not versioned row compared with FALSE' => array(
216 'Version is TRUE for NULL row compared with TRUE' => array(
225 'Multiple conditions with AND compare to TRUE if all are OK' => array(
228 'FIELD:testField:>:9',
229 'FIELD:testField:<:11',
238 'Multiple conditions with AND compare to FALSE if one fails' => array(
241 'FIELD:testField:>:9',
242 'FIELD:testField:<:11',
251 'Multiple conditions with OR compare to TRUE if one is OK' => array(
254 'FIELD:testField:<:9',
255 'FIELD:testField:<:11',
264 'Multiple conditions with OR compare to FALSE is all fail' => array(
267 'FIELD:testField:<:9',
268 'FIELD:testField:<:11',
277 'Multiple conditions without operator due to misconfiguration compare to TRUE' => array(
280 'FIELD:testField:<:9',
281 'FIELD:testField:>:11',
290 'Multiple nested conditions evaluate to TRUE' => array(
293 'FIELD:testField:>:9',
295 'FIELD:testField:<:100',
296 'FIELD:testField:>:-100',
306 'Multiple nested conditions evaluate to FALSE' => array(
309 'FIELD:testField:>:9',
311 'FIELD:testField:<:100',
312 'FIELD:testField:>:-100',
334 $this->assertEquals($expectedResult, $this->fixture->match($condition, $record, $flexformValueKey));
340 public function matchHideForNonAdminsReturnsTrueIfBackendUserIsAdmin() {
342 $backendUserMock = $this->getMock(
'TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
344 ->expects($this->once())
346 ->will($this->returnValue(TRUE));
347 $GLOBALS[
'BE_USER'] = $backendUserMock;
348 $this->assertTrue($this->fixture->match(
'HIDE_FOR_NON_ADMINS'));
354 public function matchHideForNonAdminsReturnsFalseIfBackendUserIsNotAdmin() {
356 $backendUserMock = $this->getMock(
'TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
358 ->expects($this->once())
360 ->will($this->returnValue(FALSE));
361 $GLOBALS[
'BE_USER'] = $backendUserMock;
362 $this->assertFalse($this->fixture->match(
'HIDE_FOR_NON_ADMINS'));
368 public function matchHideL10NSiblingsExceptAdminReturnsTrueIfBackendUserIsAdmin() {
370 $backendUserMock = $this->getMock(
'TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
372 ->expects($this->once())
374 ->will($this->returnValue(TRUE));
375 $GLOBALS[
'BE_USER'] = $backendUserMock;
376 $this->assertTrue($this->fixture->match(
'HIDE_L10N_SIBLINGS:except_admin'), array(),
'vEN');
382 public function matchHideL10NSiblingsExceptAdminReturnsFalseIfBackendUserIsNotAdmin() {
384 $backendUserMock = $this->getMock(
'TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
386 ->expects($this->once())
388 ->will($this->returnValue(FALSE));
389 $GLOBALS[
'BE_USER'] = $backendUserMock;
390 $this->assertFalse($this->fixture->match(
'HIDE_L10N_SIBLINGS:except_admin'), array(),
'vEN');
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]