当前位置: 首页>>代码示例>>PHP>>正文


PHP FormProtectionFactory::set方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\FormProtection\FormProtectionFactory::set方法的典型用法代码示例。如果您正苦于以下问题:PHP FormProtectionFactory::set方法的具体用法?PHP FormProtectionFactory::set怎么用?PHP FormProtectionFactory::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\FormProtection\FormProtectionFactory的用法示例。


在下文中一共展示了FormProtectionFactory::set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: logoffCleansFormProtection

 /**
  * @test
  */
 public function logoffCleansFormProtection()
 {
     $formProtection = $this->getMock('TYPO3\\CMS\\Core\\FormProtection\\BackendFormProtection', array('clean'));
     $formProtection->expects($this->atLeastOnce())->method('clean');
     \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::set('TYPO3\\CMS\\Core\\FormProtection\\BackendFormProtection', $formProtection);
     $this->fixture->logoff();
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:10,代码来源:BackendUserAuthenticationTest.php

示例2: logoffCleansFormProtectionIfBackendUserIsLoggedIn

 /**
  * @test
  */
 public function logoffCleansFormProtectionIfBackendUserIsLoggedIn()
 {
     $formProtection = $this->getMock('TYPO3\\CMS\\Core\\FormProtection\\BackendFormProtection', array('clean'), array(), '', FALSE);
     $formProtection->expects($this->once())->method('clean');
     \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::set('TYPO3\\CMS\\Core\\FormProtection\\BackendFormProtection', $formProtection);
     // logoff() call the static factory that has a dependency to a valid BE_USER object. Mock this away
     $GLOBALS['BE_USER'] = $this->getMock('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication', array(), array(), '', FALSE);
     $GLOBALS['BE_USER']->user = array('uid' => uniqid());
     $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array(), array(), '', FALSE);
     $subject = $this->getAccessibleMock('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication', array('dummy'), array(), '', FALSE);
     $subject->_set('db', $GLOBALS['TYPO3_DB']);
     $subject->logoff();
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:16,代码来源:BackendUserAuthenticationTest.php

示例3: logoffCleansFormProtectionIfBackendUserIsLoggedIn

 /**
  * @test
  */
 public function logoffCleansFormProtectionIfBackendUserIsLoggedIn()
 {
     /** @var ObjectProphecy|Connection $connection */
     $connection = $this->prophesize(Connection::class);
     $connection->delete('be_sessions', Argument::cetera())->willReturn(1);
     /** @var ObjectProphecy|ConnectionPool $connectionPool */
     $connectionPool = $this->prophesize(ConnectionPool::class);
     $connectionPool->getConnectionForTable(Argument::cetera())->willReturn($connection->reveal());
     GeneralUtility::addInstance(ConnectionPool::class, $connectionPool->reveal());
     /** @var ObjectProphecy|\TYPO3\CMS\Core\FormProtection\AbstractFormProtection $formProtection */
     $formProtection = $this->prophesize(\TYPO3\CMS\Core\FormProtection\BackendFormProtection::class);
     $formProtection->clean()->shouldBeCalled();
     \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::set('default', $formProtection->reveal());
     // logoff() call the static factory that has a dependency to a valid BE_USER object. Mock this away
     $GLOBALS['BE_USER'] = $this->getMock(BackendUserAuthentication::class, array(), array(), '', false);
     $GLOBALS['BE_USER']->user = array('uid' => $this->getUniqueId());
     $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array(), array(), '', false);
     $subject = $this->getAccessibleMock(BackendUserAuthentication::class, array('dummy'), array(), '', false);
     $subject->_set('db', $GLOBALS['TYPO3_DB']);
     $subject->logoff();
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:24,代码来源:BackendUserAuthenticationTest.php

示例4: setNotSetsInstanceForOtherType

 /**
  * @test
  */
 public function setNotSetsInstanceForOtherType()
 {
     $instance = new \TYPO3\CMS\Core\Tests\Unit\FormProtection\Fixtures\FormProtectionTesting();
     \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::set('TYPO3\\CMS\\Core\\FormProtection\\BackendFormProtection', $instance);
     $this->assertNotSame($instance, \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get('TYPO3\\CMS\\Core\\FormProtection\\InstallToolFormProtection'));
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:9,代码来源:FormProtectionFactoryTest.php


注:本文中的TYPO3\CMS\Core\FormProtection\FormProtectionFactory::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。