/** * @test * @author Karsten Dambekalns <*****@*****.**> */ public function buildPrependsIndexFileIfRewriteUrlsIsOff() { $this->router->expects($this->once())->method('resolve')->will($this->returnValue('resolvedUri')); $mockEnvironment = $this->getMock('F3\\FLOW3\\Utility\\Environment', array('isRewriteEnabled'), array(), '', FALSE); $this->uriBuilder->injectEnvironment($mockEnvironment); $expectedResult = 'index.php/resolvedUri'; $actualResult = $this->uriBuilder->build(); $this->assertEquals($expectedResult, $actualResult); }
/** * Builds the URI * * @return string The URI * @api * @author Bastian Waidelich <*****@*****.**> */ public function build() { $arguments = array(); if ($this->addQueryString === TRUE) { $arguments = $this->request->getArguments(); foreach ($this->argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) { unset($arguments[$argumentToBeExcluded]); } } $arguments = \F3\FLOW3\Utility\Arrays::arrayMergeRecursiveOverrule($arguments, $this->arguments); $uri = $this->router->resolve($arguments); $this->lastArguments = $arguments; if ($this->section !== '') { $uri .= '#' . $this->section; } if (!$this->environment->isRewriteEnabled()) { $uri = 'index.php/' . $uri; } if ($this->createAbsoluteUri === TRUE) { $uri = $this->request->getBaseUri() . $uri; } return $uri; }
/** * @test * @author Robert Lemke <*****@*****.**> */ public function buildInvokesTheRouteMethodOfTheRouter() { $this->setUpRequestBuilder(); $this->mockRouter->expects($this->once())->method('route'); $this->builder->build(); }