本文整理汇总了PHP中TYPO3\CMS\Core\Tests\UnitTestCase::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP UnitTestCase::setUp方法的具体用法?PHP UnitTestCase::setUp怎么用?PHP UnitTestCase::setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Tests\UnitTestCase
的用法示例。
在下文中一共展示了UnitTestCase::setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Sets up this test case.
*/
protected function setUp()
{
parent::setUp();
$this->elementProphecy = $this->prophesize(Element::class);
$this->objectManagerProphecy = $this->prophesize(ObjectManager::class);
$this->controllerContextProphecy = $this->prophesize(ControllerContext::class);
}
示例2: setUp
public function setUp()
{
parent::setUp();
$this->errorHandlerMock = $this->getMock('R3H6\\Error404page\\Domain\\Handler\\ErrorHandler', array('handleError'), array(), '', false);
$this->subject = $this->getMock('R3H6\\Error404page\\Domain\\Hook\\ErrorHandlerHook', array('getErrorHandler', 'getSystemLanguage'), array(), '', false);
$this->subject->expects($this->any())->method('getErrorHandler')->will($this->returnValue($this->errorHandlerMock));
}
示例3: setUp
/**
* Create a new database connection mock object for every test.
*
* @return void
*/
protected function setUp()
{
parent::setUp();
$this->connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
$this->connection->expects($this->any())->method('quoteIdentifier')->will($this->returnArgument(0));
$this->connection->expects($this->any())->method('getDatabasePlatform')->will($this->returnValue(new MockPlatform()));
}
示例4: setUp
public function setUp()
{
parent::setUp();
$this->subject = new ErrorHandlerCache();
$this->frontendUserMock = $this->getMock('R3H6\\Error404page\\Facade\\FrontendUser', get_class_methods('R3H6\\Error404page\\Facade\\FrontendUser'), array(), '', false);
$this->inject($this->subject, 'frontendUser', $this->frontendUserMock);
}
示例5: setUp
/**
* Sets up this test case.
*/
protected function setUp()
{
parent::setUp();
$this->typoScriptRepositoryProphecy = $this->prophesize(TypoScriptRepository::class);
$this->subject = $this->getAccessibleMock(Configuration::class, array('__none'));
$this->subject->_set('typoScriptRepository', $this->typoScriptRepositoryProphecy->reveal());
}
示例6: setUp
/**
* Create a new database connection mock object for every test.
*
* @return void
*/
protected function setUp()
{
parent::setUp();
$this->typoScriptFrontendController = $this->prophesize(TypoScriptFrontendController::class);
$GLOBALS['TSFE'] = $this->typoScriptFrontendController->reveal();
$this->subject = GeneralUtility::makeInstance(QueryContext::class);
}
示例7: setUp
/**
* Sets environment variables and initializes global mock object.
*/
protected function setUp()
{
parent::setUp();
$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '12345';
$this->jumpUrlHandler = $this->getMock(JumpUrlHandler::class, array('isLocationDataValid', 'getResourceFactory', 'getTypoScriptFrontendController', 'readFileAndExit', 'redirect'));
$this->tsfe = $this->getAccessibleMock(TypoScriptFrontendController::class, array('getPagesTSconfig'), array(), '', false);
$this->jumpUrlHandler->expects($this->any())->method('getTypoScriptFrontendController')->will($this->returnValue($this->tsfe));
}
示例8: setUp
/**
* Create a new database connection mock object for every test.
*
* @return void
*/
protected function setUp()
{
parent::setUp();
$this->concreteQueryBuilder = $this->prophesize(\Doctrine\DBAL\Query\QueryBuilder::class);
$this->connection = $this->prophesize(Connection::class);
$this->connection->getDatabasePlatform()->willReturn(new MockPlatform());
$this->subject = GeneralUtility::makeInstance(QueryBuilder::class, $this->connection->reveal(), null, $this->concreteQueryBuilder->reveal());
}
示例9: setUp
public 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';
}
示例10: setUp
/**
* Create a new database connection mock object for every test.
*
* @return void
*/
protected function setUp()
{
parent::setUp();
/** @var Connection|ObjectProphecy $connectionProphet */
$this->connectionProphet = $this->prophesize(Connection::class);
$this->connectionProphet->quoteIdentifier(Argument::cetera())->willReturnArgument(0);
$this->subject = new ExpressionBuilder($this->connectionProphet->reveal());
}
示例11: setUp
/**
* Create a new database connection mock object for every test.
*
* @return void
*/
protected function setUp()
{
parent::setUp();
$this->connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->setMethods(['connect', 'executeQuery', 'executeUpdate', 'getDatabasePlatform', 'getDriver', 'getExpressionBuilder', 'getWrappedConnection'])->getMock();
$this->connection->expects($this->any())->method('getExpressionBuilder')->will($this->returnValue(GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection)));
$this->connection->expects($this->any())->method('connect');
$this->connection->expects($this->any())->method('getDatabasePlatform')->will($this->returnValue(new MockPlatform()));
}
示例12: setUp
public function setUp()
{
parent::setUp();
$languageService = $this->getMock('TYPO3\\CMS\\Core\\Utility\\GeneralUtility\\LanguageService', array('sL'));
$languageService->expects($this->any())->method('sL')->will($this->returnValue('any language'));
$GLOBALS['LANG'] = $languageService;
$this->cmsLayout = $this->getAccessibleMock('Tx_MooxNews_Hooks_CmsLayout', array('dummy'));
$this->cmsLayout->_set('databaseConnection', $this->getMock('TYPO3\\CMS\\Core\\Utility\\GeneralUtility\\DatabaseConnection', array('exec_SELECTquery', 'exec_SELECTgetRows')));
}
示例13: setUp
protected function setUp()
{
parent::setUp();
$this->mockContentObject = $this->getMock(ContentObjectRenderer::class, array(), array(), '', false);
$this->viewHelper = $this->getMock(\TYPO3\CMS\Fluid\ViewHelpers\Format\CropViewHelper::class, array('renderChildren'));
$renderingContext = $this->getMock(\TYPO3\CMS\Fluid\Tests\Unit\Core\Rendering\RenderingContextFixture::class);
$this->viewHelper->setRenderingContext($renderingContext);
$this->viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('Some Content'));
}
示例14: setUp
/**
* Set up the test
*/
protected function setUp()
{
parent::setUp();
/** @var VimeoHelper|\PHPUnit_Framework_MockObject_MockObject $vimeoHelper */
$vimeoHelper = $this->getAccessibleMock(VimeoHelper::class, array('getOnlineMediaId'), array('vimeo'));
$vimeoHelper->expects($this->any())->method('getOnlineMediaId')->will($this->returnValue('7331'));
$this->subject = $this->getAccessibleMock(VimeoRenderer::class, array('getOnlineMediaHelper'), array());
$this->subject->expects($this->any())->method('getOnlineMediaHelper')->will($this->returnValue($vimeoHelper));
}
示例15: setUp
public function setUp()
{
parent::setUp();
$languageService = $this->getMock('TYPO3\\CMS\\Core\\Utility\\GeneralUtility\\LanguageService', ['sL']);
$languageService->expects($this->any())->method('sL')->will($this->returnValue('any language'));
$GLOBALS['LANG'] = $languageService;
$this->pageLayoutView = $this->getAccessibleMock('GeorgRinger\\News\\Hooks\\PageLayoutView', ['dummy']);
$this->pageLayoutView->_set('databaseConnection', $this->getMock('TYPO3\\CMS\\Core\\Utility\\GeneralUtility\\DatabaseConnection', ['exec_SELECTquery', 'exec_SELECTgetRows']));
}