예제 #1
0
 /**
  * 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);
 }
 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
0
 /**
  * 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()));
 }
 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);
 }
 /**
  * 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());
 }
 /**
  * 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
0
 /**
  * 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();
     $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());
 }
 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';
 }
 /**
  * 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
0
 /**
  * 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
0
 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')));
 }
 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
0
 /**
  * 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']));
 }
예제 #16
0
 /**
  * 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;
 }
예제 #17
0
 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'));
 }
예제 #18
0
 /**
  * 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));
 }
 /**
  * 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));
 }
예제 #20
0
 /**
  * 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;
 }
예제 #21
0
 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);
 }
 /**
  * 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());
 }
 public function setUp()
 {
     parent::setUp();
     $this->subject = new ErrorHandler();
     $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['error404page']['errorHandlers'][] = 'R3H6\\Error404page\\Tests\\Unit\\Fixtures\\TestErrorHandler';
     // Mock dependencies
     $this->errorRepositoryMock = $this->getMock('R3H6\\Error404page\\Domain\\Repository\\ErrorRepository', get_class_methods('R3H6\\Error404page\\Domain\\Repository\\ErrorRepository'), array(), '', false);
     $this->inject($this->subject, 'errorRepository', $this->errorRepositoryMock);
     $this->extensionConfigurationMock = $this->getMock('R3H6\\Error404page\\Configuration\\ExtensionConfiguration', array('is', 'get'), array(), '', false);
     $this->inject($this->subject, 'extensionConfiguration', $this->extensionConfigurationMock);
     $this->errorHandlerCacheMock = $this->getMock('R3H6\\Error404page\\Domain\\Cache\\ErrorHandlerCache', get_class_methods('R3H6\\Error404page\\Domain\\Cache\\ErrorHandlerCache'), array(), '', false);
     $this->inject($this->subject, 'errorHandlerCache', $this->errorHandlerCacheMock);
     $this->objectManagerMock = $this->getMock('TYPO3\\CMS\\Extbase\\Object\\ObjectManager', get_class_methods('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'), array(), '', false);
     $this->inject($this->subject, 'objectManager', $this->objectManagerMock);
     $this->httpServiceMock = $this->getMock('R3H6\\Error404page\\Service\\HttpService', get_class_methods('R3H6\\Error404page\\Service\\HttpService'), array(), '', false);
     $this->inject($this->subject, 'httpService', $this->httpServiceMock);
 }
예제 #24
0
 protected function setUp()
 {
     parent::setUp();
     $this->fixturesPath = __DIR__ . '/Fixtures/';
     $testTargetDir = 'testDir';
     vfsStream::setup($testTargetDir);
     $dummyExtensionDir = vfsStream::url($testTargetDir) . '/';
     $settings = \EBT\ExtensionBuilder\Utility\SpycYAMLParser::YAMLLoadString(file_get_contents($this->fixturesPath . 'Settings/settings1.yaml'));
     $this->extension = $this->getMock(\EBT\ExtensionBuilder\Domain\Model\Extension::class, array('getExtensionDir'));
     $this->extension->setVendorName('EBT');
     $this->extension->setExtensionKey('dummy');
     $this->extension->expects(self::any())->method('getExtensionDir')->will(self::returnValue($dummyExtensionDir));
     if (is_dir($dummyExtensionDir)) {
         GeneralUtility::mkdir($dummyExtensionDir, true);
     }
     $this->extension->setSettings($settings);
     $this->codeTemplateRootPath = PATH_typo3conf . 'ext/extension_builder/Resources/Private/CodeTemplates/Extbase/';
     $this->modelClassTemplatePath = $this->codeTemplateRootPath . 'Classes/Domain/Model/Model.phpt';
 }
예제 #25
0
 /**
  * Sets up this test case.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->subject = new \TYPO3\Sessions\Service\CreateTimetableService();
 }
예제 #26
0
 /**
  * Set up
  */
 protected function setUp()
 {
     parent::setUp();
     $this->subject = $this->getAccessibleMock(\TYPO3\CMS\Workspaces\ExtDirect\ExtDirectServer::class, array('__none'));
 }
예제 #27
0
 protected function setUp()
 {
     parent::setUp();
     vfsStream::setup($this->baseDirectory);
     $this->generator = new Md5sumGenerator();
 }
 /**
  * setUp
  */
 public function setUp()
 {
     parent::setUp();
     $this->fixture = GeneralUtility::makeInstance('AOE\\AoeIpauth\\Typo3\\Service\\Authentication');
 }
 public function setUp()
 {
     parent::setUp();
     $this->viewHelper = $this->getAccessibleMock('GeorgRinger\\News\\ViewHelpers\\IfIsActiveViewHelper', ['renderThenChild', 'renderElseChild']);
 }
예제 #30
0
 public function setUp()
 {
     parent::setUp();
     $GLOBALS['TCA']['tx_foo'] = array('ctrl' => array('label' => 'username', 'default_sortby' => 'ORDER BY username', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', 'title' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:tx_foo', 'delete' => 'deleted', 'enablecolumns' => array('disabled' => 'disable', 'starttime' => 'starttime', 'endtime' => 'endtime'), 'typeicon_classes' => array('default' => 'status-user-frontend'), 'searchFields' => 'username,name,first_name,last_name'), 'columns' => array('username' => array('label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:username', 'config' => array('type' => 'input', 'size' => '20', 'max' => '255', 'eval' => 'nospace,lower,uniqueInPid,required')), 'password' => array('label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:password', 'config' => array('type' => 'input', 'size' => '10', 'max' => '40', 'eval' => 'nospace,required,password')), 'usergroup' => array('label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:usergroup', 'config' => array('type' => 'select', 'foreign_table' => 'fe_groups', 'foreign_table_where' => 'ORDER BY fe_groups.title', 'size' => '6', 'minitems' => '1', 'maxitems' => '50')), 'name' => array('label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:name', 'config' => array('type' => 'input', 'size' => '40', 'eval' => 'trim', 'max' => '80')), 'first_name' => array('label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:first_name', 'config' => array('type' => 'input', 'size' => '25', 'eval' => 'trim', 'max' => '50')), 'last_name' => array('label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:last_name', 'config' => array('type' => 'input', 'size' => '25', 'eval' => 'trim', 'max' => '50')), 'middle_name' => array('label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:middle_name', 'config' => array('type' => 'input', 'size' => '25', 'eval' => 'trim', 'max' => '50')), 'alternative_name' => array('label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:alternative_name', 'config' => array('type' => 'input', 'size' => '25', 'eval' => 'trim', 'max' => '50')), 'birthday' => array('label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:birthday', 'config' => array('type' => 'input', 'size' => '25', 'eval' => 'date', 'max' => '50')), 'starttime' => array('label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:starttime', 'config' => array('type' => 'input', 'size' => '13', 'max' => '20', 'eval' => 'datetime', 'default' => '0'))), 'grid' => array('excluded_fields' => 'middle_name, alternative_name', 'columns' => array('username' => array('visible' => TRUE, 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:username', 'editable' => TRUE), 'name' => array('visible' => TRUE, 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:name', 'editable' => TRUE), 'usergroup' => array('visible' => TRUE, 'renderers' => array('Fab\\Vidi\\Grid\\RelationEditRenderer', 'Fab\\Vidi\\Grid\\RelationRenderer'), 'editable' => TRUE, 'sortable' => FALSE, 'label' => 'LLL:EXT:foo/Resources/Private/Language/tx_foo.xlf:usergroup'))));
     $GLOBALS['TYPO3_DB'] = $this->getMock('TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array());
     /*
     		#################
     		# opposite many
     		# one-to-many
     		$TCA['tx_foo_domain_model_book'] = array(
     			'columns' => array(
     				'access_codes' => array(
     					'config' => array(
     						'type' => 'inline',
     						'foreign_table' => 'tx_foo_domain_model_accesscode',
     						'foreign_field' => 'book',
     						'maxitems' => 9999,
     					),
     				),
     			),
     		);
     # opposite one
     		# many-to-one
     		$TCA['tx_foo_domain_model_accesscode'] = array(
     			'columns' => array(
     				'book' => array(
     					'config' => array(
     						'type' => 'select',
     						'foreign_table' => 'tx_foo_domain_model_book',
     						'foreign_field' => 'access_codes',
     						'minitems' => 1,
     						'maxitems' => 1,
     					),
     				),
     			),
     		);
     #################
     		# Many to many
     		$TCA['tx_foo_domain_model_book'] = array(
     			'columns' => array(
     				'tx_myext_locations' => array(
     					'config' => array(
     						'type' => 'select',
     						'foreign_table' => 'tx_foo_domain_categories',
     						'MM_opposite_field' => 'usage_mm',
     						'MM' => 'tx_foo_domain_categories_mm',
     						'MM_match_fields' => array(
     							'tablenames' => 'pages'
     						),
     						'size' => 5,
     						'maxitems' => 100
     					)
     				)
     			),
     		);
     $TCA['tx_foo_domain_categories'] = array(
     			'columns' => array(
     				'usage_mm' => array(
     					'config' => array(
     						'type' => 'group',
     						'internal_type' => 'db',
     						'allowed' => 'pages,tt_news',
     						'prepend_tname' => 1,
     						'size' => 5,
     						'maxitems' => 100,
     						'MM' => 'tx_foo_domain_categories_mm'
     					)
     				)
     			),
     		);
     #################
     		# Legacy MM relation
     		$TCA['tx_foo_domain_model_book'] = array(
     			'columns' => array(
     				'fe_groups' => array(
     					'config' => array(
     						'type' => 'inline',
     						'foreign_table' => 'tx_foo_domain_model_accesscode',
     						'foreign_field' => 'book',
     						'maxitems' => 9999,
     					),
     				),
     			),
     		);
     */
 }