예제 #1
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'));
 }
예제 #2
0
 /**
  * @test
  * @expectedException \TYPO3\CMS\Extbase\Exception
  */
 public function getTargetPidByPluginSignatureThrowsExceptionIfMoreThanOneTargetPidsWereFound()
 {
     $this->mockConfigurationManager->expects($this->once())->method('getConfiguration')->will($this->returnValue(array('view' => array('defaultPid' => 'auto'))));
     $GLOBALS['TSFE']->sys_page = $this->getMock(\TYPO3\CMS\Frontend\Page\PageRepository::class, array('enableFields'));
     $GLOBALS['TSFE']->sys_page->expects($this->once())->method('enableFields')->will($this->returnValue(' AND enable_fields'));
     $GLOBALS['TYPO3_DB']->expects($this->once())->method('fullQuoteStr')->will($this->returnValue('"pluginSignature"'));
     $GLOBALS['TYPO3_DB']->expects($this->once())->method('exec_SELECTgetRows')->will($this->returnValue(array(array('pid' => 123), array('pid' => 124))));
     $this->extensionService->getTargetPidByPlugin('ExtensionName', 'SomePlugin');
 }
예제 #3
0
 /**
  * @test
  * @expectedException \TYPO3\CMS\Core\Error\Http\PageNotFoundException
  */
 public function buildThrowsPageNotFoundExceptionIfEnabledAndSpecifiedActionIsNotAllowed()
 {
     $this->configuration['mvc']['throwPageNotFoundExceptionIfActionCantBeResolved'] = 1;
     $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($this->configuration));
     $this->requestBuilder->_set('configurationManager', $this->mockConfigurationManager);
     $this->mockExtensionService->expects($this->any())->method('getPluginNamespace')->will($this->returnValue('tx_myextension_pi1'));
     $this->requestBuilder->_set('extensionService', $this->mockExtensionService);
     $_GET = array('tx_myextension_pi1' => array('action' => 'someInvalidAction'));
     $this->requestBuilder->build();
 }
예제 #4
0
 /**
  * @test
  */
 public function constructorCreatesContentObjectIfItIsNotSpecified()
 {
     // FIXME should be compared with identicalTo() - but that does not seem to work
     $this->mockConfigurationManager->expects($this->once())->method('setContentObject')->with($this->equalTo($this->mockContentObject));
     new \TYPO3\CMS\Fluid\View\StandaloneView();
 }
 /**
  * @test
  */
 public function constructorCreatesContentObjectIfItIsNotSpecified()
 {
     $this->mockConfigurationManager->expects($this->once())->method('setContentObject')->with($this->identicalTo($this->mockContentObject));
     new StandaloneView();
 }
예제 #6
0
 /**
  * Sets up this test case
  *
  * @return void
  */
 public function setUp()
 {
     $this->configurationManager = $this->getMockBuilder(ConfigurationManager::class)->setMethods(['getConfiguration'])->getMock();
     $this->configurationManager->expects($this->once())->method('getConfiguration')->with($this->equalTo('Settings'))->will($this->returnValue(self::$settingsFixture));
     $this->sut = new Configuration($this->configurationManager);
 }