本文整理匯總了PHP中TYPO3\CMS\Core\Tests\AccessibleObjectInterface::expects方法的典型用法代碼示例。如果您正苦於以下問題:PHP AccessibleObjectInterface::expects方法的具體用法?PHP AccessibleObjectInterface::expects怎麽用?PHP AccessibleObjectInterface::expects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TYPO3\CMS\Core\Tests\AccessibleObjectInterface
的用法示例。
在下文中一共展示了AccessibleObjectInterface::expects方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUp
/**
* @return void
*/
protected function setUp() {
$this->command = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Cli\Command::class, array('getCommandMethodReflection'), array(), '', FALSE);
$this->mockMethodReflection = $this->getMock(\TYPO3\CMS\Extbase\Reflection\MethodReflection::class, array(), array(), '', FALSE);
$this->command->expects($this->any())->method('getCommandMethodReflection')->will($this->returnValue($this->mockMethodReflection));
$this->mockObjectManager = $this->getMock(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface::class);
$this->command->_set('objectManager', $this->mockObjectManager);
}
示例2: initializeObjectSetsRespectStoragePidToFalse
/**
* @test
*/
public function initializeObjectSetsRespectStoragePidToFalse()
{
$this->querySettings->expects($this->atLeastOnce())->method('setRespectStoragePage')->with(false);
$fixture = $this->getMock(\TYPO3\CMS\Belog\Domain\Repository\HistoryEntryRepository::class, array('setDefaultQuerySettings'), array($this->objectManager));
$fixture->expects($this->once())->method('setDefaultQuerySettings')->with($this->querySettings);
$fixture->initializeObject();
}
示例3: executeCallsLogExceptionOnCaughtExceptionAndRethrowsException
/**
* @test
* @expectedException Exception
*/
public function executeCallsLogExceptionOnCaughtExceptionAndRethrowsException()
{
$this->taskExecutor->expects($this->once())->method('execute')->will($this->throwException(new \Exception()));
$this->task->_set('taskExecutor', $this->taskExecutor);
$this->task->expects($this->once())->method('logException');
$this->task->execute();
}
示例4: setUp
/**
* @return void
*/
public function setUp()
{
$this->command = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Command', array('getCommandMethodReflection'), array(), '', FALSE);
$this->mockMethodReflection = $this->getMock('TYPO3\\CMS\\Extbase\\Reflection\\MethodReflection', array(), array(), '', FALSE);
$this->command->expects($this->any())->method('getCommandMethodReflection')->will($this->returnValue($this->mockMethodReflection));
$this->mockObjectManager = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface');
$this->command->_set('objectManager', $this->mockObjectManager);
}
示例5: renderReturnsResultOfContentObjectRenderer
/**
* @test
*/
public function renderReturnsResultOfContentObjectRenderer()
{
$this->subject->expects($this->any())->method('renderChildren')->will($this->returnValue('innerContent'));
$contentObjectRendererMock = $this->getMock(ContentObjectRenderer::class, array(), array(), '', false);
$contentObjectRendererMock->expects($this->once())->method('stdWrap')->will($this->returnValue('foo'));
GeneralUtility::addInstance(ContentObjectRenderer::class, $contentObjectRendererMock);
$this->assertEquals('foo', $this->subject->render('42'));
}
示例6: moduleDispatcherIsCalled
/**
* @test
* @expectedException \InvalidArgumentException
* @expectedExceptionCode 1425236663
*/
public function moduleDispatcherIsCalled()
{
$GLOBALS['TBE_MODULES'] = array('_PATHS' => array('module_fixture' => __DIR__ . '/../Fixtures/ModuleFixture/'));
$this->requestMock->expects($this->any())->method('getQueryParams')->will($this->returnValue(array('M' => 'module_fixture')));
$this->formProtectionMock->expects($this->once())->method('validateToken')->will($this->returnValue(true));
$this->subject->expects($this->once())->method('boot');
$this->subject->expects($this->atLeastOnce())->method('getFormProtection')->will($this->returnValue($this->formProtectionMock));
$this->subject->handleRequest($this->requestMock);
}
示例7: moduleDispatcherIsCalled
/**
* @test
* @expectedException \InvalidArgumentException
* @expectedExceptionCode 1425236663
*/
public function moduleDispatcherIsCalled()
{
$GLOBALS['TBE_MODULES'] = array('_PATHS' => array('_dispatcher' => array(), 'module_fixture' => __DIR__ . '/Fixtures/ModuleFixture/'));
$_GET['M'] = 'module_fixture';
$this->formProtectionMock->expects($this->once())->method('validateToken')->will($this->returnValue(TRUE));
$this->subject->expects($this->once())->method('boot');
$this->subject->expects($this->once())->method('getFormProtection')->will($this->returnValue($this->formProtectionMock));
$this->subject->handleRequest();
}
示例8: createEntryFromRawDataSetsPropertiesInEntryObject
/**
* @test
*/
public function createEntryFromRawDataSetsPropertiesInEntryObject()
{
$rawModule = array('name' => 'nameTest', 'title' => 'titleTest', 'onclick' => 'onclickTest', 'icon' => array('test' => '123'), 'link' => 'linkTest', 'description' => 'descriptionTest', 'navigationComponentId' => 'navigationComponentIdTest');
$languageServiceMock = $this->getMock(\TYPO3\CMS\Lang\LanguageService::class, array(), array(), '', false);
$languageServiceMock->expects($this->once())->method('sL')->will($this->returnValue('titleTest'));
$this->moduleController->expects($this->once())->method('getLanguageService')->will($this->returnValue($languageServiceMock));
/** @var $entry \TYPO3\CMS\Backend\Domain\Model\Module\BackendModule */
$entry = $this->moduleController->_call('createEntryFromRawData', $rawModule);
$this->assertEquals('nameTest', $entry->getName());
$this->assertEquals('titleTest', $entry->getTitle());
$this->assertEquals('linkTest', $entry->getLink());
$this->assertEquals('onclickTest', $entry->getOnClick());
$this->assertEquals('navigationComponentIdTest', $entry->getNavigationComponentId());
$this->assertEquals('descriptionTest', $entry->getDescription());
$this->assertEquals(array('test' => '123'), $entry->getIcon());
}
示例9: 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', 'getOrParseAndStoreTemplate'), array(), '', false);
$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->mockTemplatePaths = $this->getMock(TemplatePaths::class);
$this->mockViewHelperVariableContainer = $this->getMock(ViewHelperVariableContainer::class);
$this->mockRenderingContext = $this->getMock(\TYPO3\CMS\Fluid\Tests\Unit\Core\Rendering\RenderingContextFixture::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->mockRenderingContext->expects($this->any())->method('getVariableProvider')->willReturn($this->mockVariableProvider);
$this->mockRenderingContext->expects($this->any())->method('getTemplatePaths')->willReturn($this->mockTemplatePaths);
$this->view->_set('objectManager', $this->mockObjectManager);
$this->view->_set('baseRenderingContext', $this->mockRenderingContext);
$this->view->_set('controllerContext', $this->mockControllerContext);
$this->view->expects($this->any())->method('getOrParseAndStoreTemplate')->willReturn($this->mockParsedTemplate);
GeneralUtility::setSingletonInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class, $this->mockObjectManager);
GeneralUtility::addInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class, $this->mockContentObject);
$this->mockCacheManager = $this->getMock(\TYPO3\CMS\Core\Cache\CacheManager::class, array(), array(), '', false);
$mockCache = $this->getMock(\TYPO3Fluid\Fluid\Core\Cache\FluidCacheInterface::class, array(), array(), '', false);
$this->mockCacheManager->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Cache\CacheManager::class, $this->mockCacheManager);
}
示例10: 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']);
}
示例11: baseArgumentDoesNotAffectAbsoluteTime
/**
* @test
*/
public function baseArgumentDoesNotAffectAbsoluteTime()
{
$this->subject->expects($this->never())->method('renderChildren');
$actualResult = $this->subject->render('@1435784732', 'Y', 1485907200);
// somewhere in 2017
$this->assertEquals('2015', $actualResult);
}
示例12: testWithDataAndSourceCollection
/**
* @return void
*/
public function testWithDataAndSourceCollection()
{
$this->file->expects($this->at(1))->method('process')->will($this->returnValue($this->processedFiles[1]));
$this->file->expects($this->at(2))->method('process')->will($this->returnValue($this->processedFiles[2]));
$this->file->expects($this->at(3))->method('process')->will($this->returnValue($this->processedFiles[0]));
$this->imageRendererConfiguration->expects($this->once())->method('getSourceCollection')->will($this->returnValue([10 => ['width' => '360m', 'dataKey' => 'small'], 20 => ['width' => '720m', 'dataKey' => 'small-retina']]));
$this->imageRendererConfiguration->expects($this->once())->method('getLayoutKey')->will($this->returnValue('data'));
$this->assertEquals('<img src="image.jpg" alt="alt" title="title" data-small="image360.jpg" data-small-retina="image720.jpg" />', $this->imageRenderer->render($this->file, '1000', '1000', []));
}
示例13: forceAbsoluteUrlReturnsCorrectAbsoluteUrlWithSubfolder
/**
* @test
*/
public function forceAbsoluteUrlReturnsCorrectAbsoluteUrlWithSubfolder()
{
// Force hostname and subfolder
$this->subject->expects($this->any())->method('getEnvironmentVariable')->will($this->returnValueMap(array(array('HTTP_HOST', 'localhost'), array('TYPO3_SITE_PATH', '/subfolder/'))));
$expected = 'http://localhost/subfolder/fileadmin/my.pdf';
$url = 'fileadmin/my.pdf';
$configuration = array('forceAbsoluteUrl' => '1');
$this->assertEquals($expected, $this->subject->_call('forceAbsoluteUrl', $url, $configuration));
}
示例14: processAjaxRequestUnzipProcessActuallyDoesNotChangeFileData
/**
* @test
*/
public function processAjaxRequestUnzipProcessActuallyDoesNotChangeFileData()
{
$this->fileController = $this->getAccessibleMock(\TYPO3\CMS\Backend\Controller\File\FileController::class, array('init', 'main'));
$fileData = array('unzip' => array(true));
$this->fileController->_set('fileProcessor', $this->mockFileProcessor);
$this->fileController->_set('fileData', $fileData);
$this->fileController->_set('redirect', false);
$this->fileController->expects($this->once())->method('main');
$this->fileController->processAjaxRequest($this->request, $this->response);
}
示例15: concatenatedJsFileIsFlaggedToNotConcatenateAgain
/**
* @test
*/
public function concatenatedJsFileIsFlaggedToNotConcatenateAgain()
{
$fileName = 'fooFile.js';
$concatenatedFileName = 'merged_' . $fileName;
$testFileFixture = array($fileName => array('file' => $fileName, 'excludeFromConcatenation' => false, 'section' => 'top'));
$this->subject->expects($this->once())->method('createMergedJsFile')->will($this->returnValue($concatenatedFileName));
$result = $this->subject->concatenateJsFiles($testFileFixture);
$this->assertArrayHasKey($concatenatedFileName, $result);
$this->assertArrayHasKey('excludeFromConcatenation', $result[$concatenatedFileName]);
$this->assertTrue($result[$concatenatedFileName]['excludeFromConcatenation']);
}