當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。