If set, the current query parameters will be merged with $this->arguments. Defaults to FALSE.
public setAddQueryString ( boolean $addQueryString ) : |
||
$addQueryString | boolean | |
return | the current UriBuilder to allow method chaining |
/** * @test */ public function buildWithAddQueryStringMergesAllArgumentsAndKeepsRequestBoundariesIntact() { $expectedArguments = ['SubNamespace' => ['SubSubNamespace' => ['Foo' => 'Overruled'], 'Some' => 'Retained Argument From Parent Request'], 'Some' => 'Other Argument From Request']; $this->mockMainRequest->expects($this->any())->method('getArguments')->will($this->returnValue(['Some' => 'Other Argument From Request'])); $this->mockSubRequest->expects($this->any())->method('getArgumentNamespace')->will($this->returnValue('SubNamespace')); $this->mockSubRequest->expects($this->once())->method('getArguments')->will($this->returnValue(['Some' => 'Retained Argument From Parent Request'])); $this->mockSubSubRequest->expects($this->any())->method('getArgumentNamespace')->will($this->returnValue('SubSubNamespace')); $this->mockSubSubRequest->expects($this->any())->method('getArguments')->will($this->returnValue(['Foo' => 'SomeArgument'])); $this->uriBuilder->setRequest($this->mockSubSubRequest); $this->uriBuilder->setArguments(['SubNamespace' => ['SubSubNamespace' => ['Foo' => 'Overruled']]]); $this->uriBuilder->setAddQueryString(true); $this->uriBuilder->build(); $this->assertEquals($expectedArguments, $this->uriBuilder->getLastArguments()); }