예제 #1
0
 /**
  * Sets up this test case
  *
  */
 public function setUp()
 {
     $this->mockObjectManager = $this->getMock('TYPO3\\Flow\\Object\\ObjectManagerInterface');
     $this->mockObjectManager->expects($this->any())->method('create')->will($this->returnCallback(array($this, 'objectManagerCallBack')));
     $this->route = $this->getAccessibleMock('TYPO3\\Flow\\Mvc\\Routing\\Route', array('dummy'));
     $this->route->_set('objectManager', $this->mockObjectManager);
     $this->mockRouter = $this->getMock('TYPO3\\Flow\\Mvc\\Routing\\RouterInterface');
     $this->mockRouter->expects($this->any())->method('getControllerObjectName')->will($this->returnValue('SomeControllerObjectName'));
     $this->inject($this->route, 'router', $this->mockRouter);
     $this->mockPersistenceManager = $this->getMock('TYPO3\\Flow\\Persistence\\PersistenceManagerInterface');
     $this->mockPersistenceManager->expects($this->any())->method('convertObjectsToIdentityArrays')->will($this->returnCallback(function ($array) {
         return $array;
     }));
     $this->inject($this->route, 'persistenceManager', $this->mockPersistenceManager);
 }
예제 #2
0
 /**
  * @test
  */
 public function buildPrependsIndexFileIfRewriteUrlsIsOff()
 {
     $this->mockRouter->expects($this->once())->method('resolve')->will($this->returnValue('resolvedUri'));
     $mockEnvironment = $this->getMock('TYPO3\\Flow\\Utility\\Environment', array('isRewriteEnabled'), array(), '', FALSE);
     $this->inject($this->uriBuilder, 'environment', $mockEnvironment);
     $expectedResult = 'index.php/resolvedUri';
     $actualResult = $this->uriBuilder->build();
     $this->assertEquals($expectedResult, $actualResult);
 }
 /**
  * @test
  */
 public function buildPrependsIndexFileIfRewriteUrlsIsOff()
 {
     $this->mockRouter->expects($this->once())->method('resolve')->will($this->returnValue('resolvedUri'));
     $mockEnvironment = $this->getMockBuilder(\TYPO3\Flow\Utility\Environment::class)->disableOriginalConstructor()->setMethods(array('isRewriteEnabled'))->getMock();
     $this->inject($this->uriBuilder, 'environment', $mockEnvironment);
     $expectedResult = 'index.php/resolvedUri';
     $actualResult = $this->uriBuilder->build();
     $this->assertEquals($expectedResult, $actualResult);
 }