/** * @test */ public function matchHideL10NSiblingsExceptAdminReturnsFalseIfBackendUserIsNotAdmin() { /** @var $backendUserMock \TYPO3\CMS\Core\Authentication\BackendUserAuthentication|\PHPUnit_Framework_MockObject_MockObject */ $backendUserMock = $this->getMock('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication'); $backendUserMock->expects($this->once())->method('isAdmin')->will($this->returnValue(FALSE)); $GLOBALS['BE_USER'] = $backendUserMock; $this->assertFalse($this->fixture->match('HIDE_L10N_SIBLINGS:except_admin'), array(), 'vEN'); }
/** * Evaluates the provided condition and returns TRUE if the form * element should be displayed. * The condition string is separated by colons and the first part * indicates what type of evaluation should be performed. * * @param string $displayCondition * @param array $record * @param string $flexformValueKey * @return bool * @see match() */ protected function matchSingle($displayCondition, array $record = array(), $flexformValueKey = '') { $this->record = $record; $this->flexformValueKey = $flexformValueKey; $result = FALSE; list($matchType, $condition) = explode(':', $displayCondition, 2); switch ($matchType) { case 'USER': $result = $this->matchUserCondition($condition); break; default: $result = parent::matchSingle($displayCondition, $record, $flexformValueKey); } return $result; }