/** * Sets up this test case * */ public function setUp() { $this->mockObjectManager = $this->getMock('TYPO3\\FLOW3\\Object\\ObjectManagerInterface'); $this->mockObjectManager->expects($this->any())->method('create')->will($this->returnCallback(array($this, 'objectManagerCallBack'))); $this->route = $this->getAccessibleMock('TYPO3\\FLOW3\\Mvc\\Routing\\Route', array('dummy')); $this->route->_set('objectManager', $this->mockObjectManager); $this->mockRouter = $this->getMock('TYPO3\\FLOW3\\Mvc\\Routing\\RouterInterface'); $this->mockRouter->expects($this->any())->method('getControllerObjectName')->will($this->returnValue('SomeControllerObjectName')); $this->route->injectRouter($this->mockRouter); $this->mockPersistenceManager = $this->getMock('TYPO3\\FLOW3\\Persistence\\PersistenceManagerInterface'); $this->mockPersistenceManager->expects($this->any())->method('convertObjectsToIdentityArrays')->will($this->returnCallback(function ($array) { return $array; })); $this->route->injectPersistenceManager($this->mockPersistenceManager); }
/** * @test */ public function buildPrependsIndexFileIfRewriteUrlsIsOff() { $this->mockRouter->expects($this->once())->method('resolve')->will($this->returnValue('resolvedUri')); $mockEnvironment = $this->getMock('TYPO3\\FLOW3\\Utility\\Environment', array('isRewriteEnabled'), array(), '', FALSE); $this->uriBuilder->injectEnvironment($mockEnvironment); $expectedResult = 'index.php/resolvedUri'; $actualResult = $this->uriBuilder->build(); $this->assertEquals($expectedResult, $actualResult); }