Merge branch '3.6' into 3.7

This commit is contained in:
Robbie Averill 2018-11-15 14:15:08 +02:00
commit 214c6ddb8e
2 changed files with 10 additions and 7 deletions

View File

@ -123,9 +123,10 @@ class ConfirmationTokenChain
* @return array * @return array
*/ */
public function getRedirectUrlParams() { public function getRedirectUrlParams() {
$params = array(); $params = $_GET;
unset($params['url']);
foreach ($this->filteredTokens() as $token) { foreach ($this->filteredTokens() as $token) {
$params = array_merge($params, $token->getRedirectUrlParams()); $params = array_merge($params, $token->params());
} }
return $params; return $params;

View File

@ -123,19 +123,21 @@ class ConfirmationTokenChainTest extends SapphireTest {
} }
public function testGetRedirectUrlParams() { public function testGetRedirectUrlParams() {
$mockToken = $this->getTokenRequiringReload(true, array('getRedirectUrlParams')); $mockToken = $this->getTokenRequiringReload(true, array('params'));
$mockToken->expects($this->once()) $mockToken->expects($this->once())
->method('getRedirectUrlParams') ->method('params')
->will($this->returnValue(array('mockTokenParam' => '1'))); ->will($this->returnValue(array('mockTokenParam' => '1')));
$secondMockToken = $this->getTokenRequiringReload(true, array('getRedirectUrlParams')); $secondMockToken = $this->getTokenRequiringReload(true, array('params'));
$secondMockToken->expects($this->once()) $secondMockToken->expects($this->once())
->method('getRedirectUrlParams') ->method('params')
->will($this->returnValue(array('secondMockTokenParam' => '2'))); ->will($this->returnValue(array('secondMockTokenParam' => '2')));
$chain = new ConfirmationTokenChain(); $chain = new ConfirmationTokenChain();
$chain->pushToken($mockToken); $chain->pushToken($mockToken);
$chain->pushToken($secondMockToken); $chain->pushToken($secondMockToken);
$this->assertEquals(array('mockTokenParam' => '1', 'secondMockTokenParam' => '2'), $chain->getRedirectUrlParams()); $params = $chain->getRedirectUrlParams();
$this->assertEquals('1', $params['mockTokenParam']);
$this->assertEquals('2', $params['secondMockTokenParam']);
} }
} }