From 4c9f1cc1543106f5821a1bccfda089eee9aa836f Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Tue, 20 Sep 2016 15:07:36 +0200 Subject: [PATCH] _lastAction() should also work with named parameters in the url --- .../Test/Case/View/Helper/FormHelperTest.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index 030333933..1542d93a4 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -10648,4 +10648,42 @@ class FormHelperTest extends CakeTestCase { $this->assertEquals($expected, $result); } +/** + * Tests `_lastAction`. + * + * With named, numeric value + * + * @return void + */ + public function testLastActionWithNamedNumeric() { + $here = '/users/index/page:1'; + + $this->Form->request->here = $here; + $this->Form->create('User'); + + $expected = $here; + $actual = $this->Form->_lastAction; + + $this->assertEquals($expected, $actual); + } + +/** + * Tests `_lastAction`. + * + * With named, string value + * + * @return void + */ + public function testLastActionWithNamedString() { + $here = '/users/index/foo:bar'; + + $this->Form->request->here = $here; + $this->Form->create('User'); + + $expected = $here; + $actual = $this->Form->_lastAction; + + $this->assertEquals($expected, $actual); + } + }