/** * @test * @expectedException \TYPO3\Flow\Security\Exception\InvalidHashException */ public function getReferringRequestThrowsAnExceptionIfTheHmacOfTheArgumentsCouldNotBeValid() { $serializedArguments = base64_encode('some manipulated arguments string without valid HMAC'); $referrer = array('@controller' => 'Foo', '@action' => 'bar', 'arguments' => $serializedArguments); $mockHashService = $this->getMockBuilder(\TYPO3\Flow\Security\Cryptography\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(); }