/** * 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())); }
protected function tearDown() { if (!empty($this->extension) && $this->extension->getExtensionKey() != null) { GeneralUtility::rmdir($this->extension->getExtensionDir(), true); } parent::tearDown(); }
/** * @return void */ public function tearDown() { foreach ($this->fakedExtensions as $extension => $dummy) { \TYPO3\CMS\Core\Utility\GeneralUtility::rmdir(PATH_site . 'typo3temp/' . $extension, TRUE); } parent::tearDown(); }
/** * 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); }
/** * Tear down test case */ public function tearDown() { foreach ($this->testFilesToDelete as $absoluteFileName) { \TYPO3\CMS\Core\Utility\GeneralUtility::unlink_tempfile($absoluteFileName); } parent::tearDown(); }
/** * @return void */ protected function tearDown() { foreach ($this->fakedExtensions as $fakeExtkey => $fakeExtension) { $this->testFilesToDelete[] = PATH_site . 'typo3temp/' . $fakeExtkey; } parent::tearDown(); }
/** * Tears down this test case. */ protected function tearDown() { parent::tearDown(); unset($this->elementProphecy); unset($this->objectManagerProphecy); unset($this->controllerContextProphecy); }
/** * Explicitly clean up the indexer object to prevent any memory leaks */ public function tearDown() { if ($this->temporaryFileName) { @unlink($this->temporaryFileName); } parent::tearDown(); }
public function tearDown() { Utility\GeneralUtility::resetSingletonInstances($this->singletonInstances); foreach ($this->testFilesToDelete as $absoluteFileName) { Utility\GeneralUtility::rmdir($absoluteFileName, TRUE); } parent::tearDown(); }
/** * Cleans up the environment after running a test. */ protected function tearDown() { // Restore locallangXMLOverride and localization format priority $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'] = $this->locallangXMLOverride; $GLOBALS['TYPO3_CONF_VARS']['SYS']['lang']['format']['priority'] = $this->l10nPriority; \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Localization\LanguageStore::class)->initialize(); parent::tearDown(); }
/** * 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())); }
/** * Tear down * * @return void */ protected function tearDown() { ExtensionManagementUtility::setPackageManager($this->backupPackageManager); if (file_exists(PATH_site . 'typo3temp/ExtensionCompatibilityTester.txt')) { unlink(PATH_site . 'typo3temp/ExtensionCompatibilityTester.txt'); } parent::tearDown(); }
/** * 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)); }
/** * 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()); }
protected function tearDown() { ExtensionManagementUtility::clearExtensionKeyMap(); ExtensionManagementUtilityAccessibleProxy::setPackageManager($this->backUpPackageManager); ExtensionManagementUtilityAccessibleProxy::setCacheManager(NULL); $GLOBALS['TYPO3_LOADED_EXT'] = new LoadedExtensionsArray($this->backUpPackageManager); GeneralUtility::resetSingletonInstances($this->singletonInstances); parent::tearDown(); }
protected function tearDown() { foreach ($this->backupLocales as $category => $locale) { setlocale(constant($category), $locale); } date_default_timezone_set($this->timezone); parent::tearDown(); }
/** * 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()); }
protected function tearDown() { \TYPO3\CMS\Core\Utility\GeneralUtility::resetSingletonInstances($this->singletonInstances); foreach ($this->filesCreated as $file) { unlink($file); } parent::tearDown(); }
/** * Tear down */ public function tearDown() { foreach ($this->testNodesToDelete as $node) { if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($node, PATH_site . 'typo3temp/')) { \TYPO3\CMS\Core\Utility\GeneralUtility::rmdir($node, TRUE); } } parent::tearDown(); }
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')); }
/** * 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)); }
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'])); }
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'))); }
public function setUp() { parent::setUp(); $this->mockContentObject = $this->getMock('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer', array(), array(), '', FALSE); $this->mockConfigurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface'); $this->mockConfigurationManager->expects($this->any())->method('getContentObject')->will($this->returnValue($this->mockContentObject)); $this->viewHelper = $this->getMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Format\\CropViewHelper', array('renderChildren')); $this->viewHelper->injectConfigurationManager($this->mockConfigurationManager); $this->viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('Some Content')); }
/** * Sets environment variables and initializes global mock object. */ protected function setUp() { parent::setUp(); $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = '12345'; $this->jumpUrlProcessor = $this->getMock(JumpUrlProcessorMock::class, array('getTypoScriptFrontendController', 'getContentObjectRenderer')); $this->tsfe = $this->getAccessibleMock(TypoScriptFrontendController::class, array('getPagesTSconfig'), array(), '', false); $this->jumpUrlProcessor->expects($this->any())->method('getTypoScriptFrontendController')->will($this->returnValue($this->tsfe)); $this->contentObjectRenderer = $this->getMock(ContentObjectRenderer::class); $this->jumpUrlProcessor->expects($this->any())->method('getContentObjectRenderer')->will($this->returnValue($this->contentObjectRenderer)); }
/** * Sets up this testcase */ public function setUp() { parent::setUp(); // Allow objects until 100 levels deep when executing the stdWrap $GLOBALS['TSFE'] = new \stdClass(); $GLOBALS['TSFE']->cObjectDepthCounter = 100; $this->abstractPlugin = new \TYPO3\CMS\Frontend\Plugin\AbstractPlugin(); $this->abstractPlugin->cObj = new \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer(); $this->defaultPiVars = $this->abstractPlugin->piVars; }
/** * Set up the test */ protected function setUp() { parent::setUp(); GeneralUtility::flushInternalRuntimeCaches(); $_SERVER['HTTP_HOST'] = 'test.server.org'; /** @var YouTubeHelper|\PHPUnit_Framework_MockObject_MockObject $youTubeHelper */ $youTubeHelper = $this->getAccessibleMock(YouTubeHelper::class, array('getOnlineMediaId'), array('youtube')); $youTubeHelper->expects($this->any())->method('getOnlineMediaId')->will($this->returnValue('7331')); $this->subject = $this->getAccessibleMock(YouTubeRenderer::class, array('getOnlineMediaHelper'), array()); $this->subject->expects($this->any())->method('getOnlineMediaHelper')->will($this->returnValue($youTubeHelper)); }
/** * Sets up this testcase */ protected function setUp() { parent::setUp(); // Allow objects until 100 levels deep when executing the stdWrap $GLOBALS['TSFE'] = new \stdClass(); $GLOBALS['TSFE']->cObjectDepthCounter = 100; $this->abstractPlugin = new \TYPO3\CMS\Frontend\Plugin\AbstractPlugin(); $contentObjectRenderer = new ContentObjectRenderer(); $contentObjectRenderer->setContentObjectClassMap(array('TEXT' => TextContentObject::class)); $this->abstractPlugin->cObj = $contentObjectRenderer; $this->defaultPiVars = $this->abstractPlugin->piVars; }
/** * @return void */ public function tearDown() { foreach ($this->fakedExtensions as $extension => $dummy) { \TYPO3\CMS\Core\Utility\GeneralUtility::rmdir(PATH_site . 'typo3conf/ext/' . $extension, TRUE); } foreach ($this->resourcesToRemove as $resource) { if (file_exists($resource) && is_file($resource)) { unlink($resource); } elseif (file_exists($resource) && is_dir($resource)) { rmdir($resource); } } parent::tearDown(); }
/** * Create a new database connection mock object for every test. * * @return void */ protected function setUp() { parent::setUp(); $this->connection = $this->prophesize(Connection::class); $this->connection->quoteIdentifier(Argument::cetera())->will(function ($args) { return '"' . join('"."', explode('.', $args[0])) . '"'; }); $this->connection->quote(Argument::cetera())->will(function ($args) { return "'" . $args[0] . "'"; }); $this->connection->getDatabasePlatform()->willReturn(new MockPlatform()); $this->queryContext = GeneralUtility::makeInstance(QueryContext::class); $this->expressionBuilder = GeneralUtility::makeInstance(ExpressionBuilder::class, $this->connection->reveal()); }