The referring request is not set or determined automatically but must be
explicitly set through the corresponding internal argument "__referrer".
This mechanism is used by Flow's form and validation mechanisms.
public getReferringRequest ( ) : |
||
return | the referring request, or NULL if no referrer found |
/** * @test * @expectedException \Neos\Flow\Security\Exception\InvalidHashException */ public function getReferringRequestThrowsAnExceptionIfTheHmacOfTheArgumentsCouldNotBeValid() { $serializedArguments = base64_encode('some manipulated arguments string without valid HMAC'); $referrer = ['@controller' => 'Foo', '@action' => 'bar', 'arguments' => $serializedArguments]; $mockHashService = $this->getMockBuilder(HashService::class)->getMock(); $mockHashService->expects($this->once())->method('validateAndStripHmac')->with($serializedArguments)->will($this->throwException(new InvalidHashException())); $this->inject($this->actionRequest, 'hashService', $mockHashService); $this->actionRequest->setArgument('__referrer', $referrer); $this->actionRequest->getReferringRequest(); }