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


PHP PHPUnit_Framework_MockObject_MockObject::_set方法代码示例

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


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

示例1: setUp

 /**
  * Sets up this testcase
  */
 protected function setUp()
 {
     $GLOBALS['TYPO3_DB'] = $this->getMock(\TYPO3\CMS\Core\Database\DatabaseConnection::class, array());
     $this->backendConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::class, array('getTypoScriptSetup'));
     $this->mockTypoScriptService = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Service\TypoScriptService::class);
     $this->backendConfigurationManager->_set('typoScriptService', $this->mockTypoScriptService);
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:10,代码来源:BackendConfigurationManagerTest.php

示例2: setUp

 /**
  * Set up
  */
 public function setUp()
 {
     parent::setUp();
     $this->viewHelper = $this->getAccessibleMock('Tx_MooxNews_ViewHelpers_SimplePrevNextViewHelper', array('dummy'));
     $mockedDatabaseConnection = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array('exec_SELECTgetSingleRow'));
     $this->viewHelper->_set('databaseConnection', $mockedDatabaseConnection);
 }
开发者ID:preinboth,项目名称:moox_news,代码行数:10,代码来源:SimplePrevNextViewHelperTest.php

示例3: addMockViewToFixture

 /**
  * Add a mock standalone view to fixture
  */
 protected function addMockViewToFixture()
 {
     $this->standaloneView = $this->getMock('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
     $this->request = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Request');
     $this->standaloneView->expects($this->any())->method('getRequest')->will($this->returnValue($this->request));
     $this->fixture->_set('view', $this->standaloneView);
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:10,代码来源:FluidTemplateContentObjectTest.php

示例4: persistSessionTokenWritesTokensToSession

 /**
  * @test
  */
 public function persistSessionTokenWritesTokensToSession()
 {
     $_SESSION['installToolFormToken'] = 'foo';
     $this->fixture->_set('sessionToken', '881ffea2159ac72182557b79dc0c723f5a8d20136f9fab56cdd4f8b3a1dbcfcd');
     $this->fixture->persistSessionToken();
     $this->assertEquals('881ffea2159ac72182557b79dc0c723f5a8d20136f9fab56cdd4f8b3a1dbcfcd', $_SESSION['installToolFormToken']);
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:10,代码来源:InstallToolFormProtectionTest.php

示例5: addMockViewToSubject

 /**
  * Add a mock standalone view to subject
  */
 protected function addMockViewToSubject()
 {
     $this->standaloneView = $this->getMock(\TYPO3\CMS\Fluid\View\StandaloneView::class, array(), array(), '', false);
     $this->request = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Request::class);
     $this->standaloneView->expects($this->any())->method('getRequest')->will($this->returnValue($this->request));
     $this->subject->_set('view', $this->standaloneView);
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:10,代码来源:FluidTemplateContentObjectTest.php

示例6: setUp

 /**
  * Set up
  *
  * @return void
  */
 protected function setUp()
 {
     // Mock system under test to make protected methods accessible
     $this->configurationItemRepository = $this->getAccessibleMock(\TYPO3\CMS\Extensionmanager\Domain\Repository\ConfigurationItemRepository::class, array('dummy'));
     $this->injectedObjectManagerMock = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class, array(), array(), '', FALSE);
     $this->configurationItemRepository->_set('objectManager', $this->injectedObjectManagerMock);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:12,代码来源:ConfigurationItemRepositoryTest.php

示例7: setUp

 /**
  * Sets up this testcase
  */
 public function setUp()
 {
     $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array());
     $this->backendConfigurationManager = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Configuration\\BackendConfigurationManager', array('getTypoScriptSetup'));
     $this->mockTypoScriptService = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService');
     $this->backendConfigurationManager->_set('typoScriptService', $this->mockTypoScriptService);
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:10,代码来源:BackendConfigurationManagerTest.php

示例8: setUp

 /**
  * Set up
  */
 public function setUp()
 {
     parent::setUp();
     $this->viewHelper = $this->getAccessibleMock('GeorgRinger\\News\\ViewHelpers\\SimplePrevNextViewHelper', ['dummy']);
     $mockedDatabaseConnection = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', ['exec_SELECTgetSingleRow']);
     $this->viewHelper->_set('databaseConnection', $mockedDatabaseConnection);
 }
开发者ID:BastianBalthasarBux,项目名称:news,代码行数:10,代码来源:SimplePrevNextViewHelperTest.php

示例9: processReenablesEscapingInterceptorOnClosingViewHelperTagIfItWasDisabledBefore

 /**
  * @test
  */
 public function processReenablesEscapingInterceptorOnClosingViewHelperTagIfItWasDisabledBefore()
 {
     $interceptorPosition = InterceptorInterface::INTERCEPT_CLOSING_VIEWHELPER;
     $this->mockViewHelper->expects($this->any())->method('isOutputEscapingEnabled')->will($this->returnValue(false));
     $this->mockNode->expects($this->any())->method('getUninitializedViewHelper')->will($this->returnValue($this->mockViewHelper));
     $this->escapeInterceptor->_set('childrenEscapingEnabled', false);
     $this->escapeInterceptor->_set('viewHelperNodesWhichDisableTheInterceptor', array($this->mockNode));
     $this->escapeInterceptor->process($this->mockNode, $interceptorPosition, $this->mockParsingState);
     $this->assertTrue($this->escapeInterceptor->_get('childrenEscapingEnabled'));
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:13,代码来源:EscapeTest.php

示例10: setUp

 protected function setUp()
 {
     parent::setUp();
     // Store all locale categories manipulated in tests for reconstruction in tearDown
     $this->backupLocales = array('LC_COLLATE' => setlocale(LC_COLLATE, 0), 'LC_CTYPE' => setlocale(LC_CTYPE, 0), 'LC_MONETARY' => setlocale(LC_MONETARY, 0), 'LC_TIME' => setlocale(LC_TIME, 0));
     $this->timezone = @date_default_timezone_get();
     $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] = 'Y-m-d';
     $this->subject = $this->getAccessibleMock(DateViewHelper::class, array('renderChildren'));
     /** @var RenderingContext $renderingContext */
     $renderingContext = $this->getMock(RenderingContext::class);
     $this->subject->_set('renderingContext', $renderingContext);
 }
开发者ID:vip3out,项目名称:TYPO3.CMS,代码行数:12,代码来源:DateViewHelperTest.php

示例11: settingRequestAdminPropertySetsAdminRoleInUserAuthentication

 /**
  * @test
  */
 public function settingRequestAdminPropertySetsAdminRoleInUserAuthentication()
 {
     $mockedUserAuthentication = $this->getMock(\TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::class);
     $mockedUserAuthentication->user['admin'] = 42;
     $this->commandController->expects($this->once())->method('dummyCommand')->will($this->returnCallback(function () use($mockedUserAuthentication) {
         if ($mockedUserAuthentication->user['admin'] !== 1) {
             throw new \Exception('User role is not admin');
         }
     }));
     $this->commandController->_set('userAuthentication', $mockedUserAuthentication);
     $this->commandController->_set('arguments', array());
     $this->commandController->_set('commandMethodName', 'dummyCommand');
     $this->commandController->_set('requestAdminPermissions', TRUE);
     $this->commandController->_call('callCommandMethod');
     $this->assertSame(42, $mockedUserAuthentication->user['admin']);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:19,代码来源:CommandControllerTest.php

示例12: persistSessionTokenWritesTokenToSession

 /**
  * @test
  */
 public function persistSessionTokenWritesTokenToSession()
 {
     $sessionToken = $this->getUniqueId('test_');
     $this->subject->_set('sessionToken', $sessionToken);
     $this->getBackendUser()->expects($this->once())->method('setAndSaveSessionData')->with('formSessionToken', $sessionToken);
     $this->subject->persistSessionToken();
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:10,代码来源:BackendFormProtectionTest.php

示例13: dispatchThrowsInvalidSlotExceptionIfObjectManagerOfSignalSlotDispatcherIsNotSet

 /**
  * @test
  * @expectedException \TYPO3\CMS\Extbase\SignalSlot\Exception\InvalidSlotException
  */
 public function dispatchThrowsInvalidSlotExceptionIfObjectManagerOfSignalSlotDispatcherIsNotSet()
 {
     $this->signalSlotDispatcher->_set('isInitialized', true);
     $this->signalSlotDispatcher->_set('objectManager', null);
     $this->signalSlotDispatcher->_set('slots', array('ClassA' => array('emitSomeSignal' => array(array()))));
     $this->assertSame(null, $this->signalSlotDispatcher->dispatch('ClassA', 'emitSomeSignal'));
 }
开发者ID:CDRO,项目名称:TYPO3.CMS,代码行数:11,代码来源:DispatcherTest.php

示例14: setUp

 /**
  * Sets up this test case
  *
  * @return void
  */
 protected function setUp()
 {
     $this->singletonInstances = GeneralUtility::getSingletonInstances();
     $this->view = $this->getAccessibleMock(\TYPO3\CMS\Fluid\View\StandaloneView::class, array('testFileExistence', 'buildParserConfiguration'), array(), '', FALSE);
     $this->mockTemplateParser = $this->getMock(TemplateParser::class);
     $this->mockParsedTemplate = $this->getMock(\TYPO3\CMS\Fluid\Core\Parser\ParsedTemplateInterface::class);
     $this->mockTemplateParser->expects($this->any())->method('parse')->will($this->returnValue($this->mockParsedTemplate));
     $this->mockConfigurationManager = $this->getMock(ConfigurationManagerInterface::class);
     $this->mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
     $this->mockObjectManager->expects($this->any())->method('get')->will($this->returnCallback(array($this, 'objectManagerCallback')));
     $this->mockRequest = $this->getMock(Request::class);
     $this->mockUriBuilder = $this->getMock(UriBuilder::class);
     $this->mockContentObject = $this->getMock(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
     $this->mockControllerContext = $this->getMock(ControllerContext::class);
     $this->mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->mockRequest));
     $this->mockViewHelperVariableContainer = $this->getMock(\TYPO3\CMS\Fluid\Core\ViewHelper\ViewHelperVariableContainer::class);
     $this->mockRenderingContext = $this->getMock(RenderingContext::class);
     $this->mockRenderingContext->expects($this->any())->method('getControllerContext')->will($this->returnValue($this->mockControllerContext));
     $this->mockRenderingContext->expects($this->any())->method('getViewHelperVariableContainer')->will($this->returnValue($this->mockViewHelperVariableContainer));
     $this->view->_set('templateParser', $this->mockTemplateParser);
     $this->view->_set('objectManager', $this->mockObjectManager);
     $this->view->setRenderingContext($this->mockRenderingContext);
     $this->mockTemplateCompiler = $this->getMock(TemplateCompiler::class);
     $this->view->_set('templateCompiler', $this->mockTemplateCompiler);
     GeneralUtility::setSingletonInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class, $this->mockObjectManager);
     GeneralUtility::addInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class, $this->mockContentObject);
     $mockCacheManager = $this->getMock(\TYPO3\CMS\Core\Cache\CacheManager::class, array(), array(), '', FALSE);
     $mockCache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class, array(), array(), '', FALSE);
     $mockCacheManager->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
     GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Cache\CacheManager::class, $mockCacheManager);
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:36,代码来源:StandaloneViewTest.php

示例15: setUp

 /**
  * Sets up this test case
  *
  * @return void
  */
 public function setUp()
 {
     $this->singletonInstances = GeneralUtility::getSingletonInstances();
     $this->view = $this->getAccessibleMock('TYPO3\\CMS\\Fluid\\View\\StandaloneView', array('testFileExistence', 'buildParserConfiguration'), array(), '', FALSE);
     $this->mockTemplateParser = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\TemplateParser');
     $this->mockParsedTemplate = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Parser\\ParsedTemplateInterface');
     $this->mockTemplateParser->expects($this->any())->method('parse')->will($this->returnValue($this->mockParsedTemplate));
     $this->mockConfigurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
     $this->mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->mockObjectManager->expects($this->any())->method('get')->will($this->returnCallback(array($this, 'objectManagerCallback')));
     $this->mockRequest = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request');
     $this->mockUriBuilder = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder');
     $this->mockFlashMessageContainer = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\FlashMessageContainer');
     $this->mockContentObject = $this->getMock('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     $this->mockControllerContext = $this->getMock('TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ControllerContext');
     $this->mockControllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->mockRequest));
     $this->mockViewHelperVariableContainer = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\ViewHelperVariableContainer');
     $this->mockRenderingContext = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Rendering\\RenderingContext');
     $this->mockRenderingContext->expects($this->any())->method('getControllerContext')->will($this->returnValue($this->mockControllerContext));
     $this->mockRenderingContext->expects($this->any())->method('getViewHelperVariableContainer')->will($this->returnValue($this->mockViewHelperVariableContainer));
     $this->view->_set('templateParser', $this->mockTemplateParser);
     $this->view->_set('objectManager', $this->mockObjectManager);
     $this->view->setRenderingContext($this->mockRenderingContext);
     $this->mockTemplateCompiler = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\Compiler\\TemplateCompiler');
     $this->view->_set('templateCompiler', $this->mockTemplateCompiler);
     GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager', $this->mockObjectManager);
     GeneralUtility::addInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer', $this->mockContentObject);
     /** @var \TYPO3\CMS\Core\Cache\CacheManager|\PHPUnit_Framework_MockObject_MockObject $mockCacheManager */
     $mockCacheManager = $this->getMock('TYPO3\\CMS\\Core\\Cache\\CacheManager', array(), array(), '', FALSE);
     $mockCache = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\PhpFrontend', array(), array(), '', FALSE);
     $mockCacheManager->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
     GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager', $mockCacheManager);
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:38,代码来源:StandaloneViewTest.php


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