mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge branch '3.6' into 3.7
This commit is contained in:
commit
214c6ddb8e
@ -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;
|
||||||
|
@ -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']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user