/** * @test * @author Bastian Waidelich <*****@*****.**> */ public function buildPrependsBaseUriIfCreateAbsoluteUriIsSet() { $this->router->expects($this->once())->method('resolve')->will($this->returnValue('resolvedUri')); $this->request->expects($this->once())->method('getBaseUri')->will($this->returnValue('BaseUri/')); $this->uriBuilder->setCreateAbsoluteUri(TRUE); $expectedResult = 'BaseUri/resolvedUri'; $actualResult = $this->uriBuilder->build(); $this->assertEquals($expectedResult, $actualResult); }
/** * @test * @author Bastian Waidelich <*****@*****.**> */ public function buildSetsPOSTArgumentsFromRequest() { $this->setUpRequestBuilder(); $argument = NULL; $setArgumentCallback = function () use(&$argument) { $args = func_get_args(); if ($args[0] === 'someArgument') { $argument = $args[1]; } }; $this->mockRequest->expects($this->any())->method('getMethod')->will($this->returnValue('POST')); $this->mockEnvironment->expects($this->any())->method('getRawPostArguments')->will($this->returnValue(array('someArgument' => 'POSTArgument'))); $this->mockEnvironment->expects($this->any())->method('getUploadedFiles')->will($this->returnValue(array())); $this->mockRequest->expects($this->exactly(2))->method('setArgument')->will($this->returnCallback($setArgumentCallback)); $this->builder->build(); $this->assertEquals('POSTArgument', $argument); }