Skip to content

Commit 04a1c77

Browse files
author
Volodymyr Kublytskyi
committed
MAGETWO-83287: magento#11825: Generate new FormKey and replace for oldRequestParams Wishlist magento#12038
- fixed unit test
1 parent 7edc2d4 commit 04a1c77

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

app/code/Magento/Customer/Test/Unit/Model/Plugin/CustomerFlushFormKeyTest.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@
99
use Magento\Customer\Model\Session;
1010
use Magento\Framework\App\PageCache\FormKey as CookieFormKey;
1111
use Magento\Framework\Data\Form\FormKey as DataFormKey;
12+
use Magento\Framework\Event\Observer;
1213
use Magento\PageCache\Observer\FlushFormKey;
1314
use PHPUnit\Framework\TestCase;
1415
use PHPUnit_Framework_MockObject_MockObject as MockObject;
1516

1617
class CustomerFlushFormKeyTest extends TestCase
1718
{
18-
const CLOSURE_VALUE = 'CLOSURE';
19-
2019
/**
2120
* @var CookieFormKey | MockObject
2221
*/
@@ -32,11 +31,6 @@ class CustomerFlushFormKeyTest extends TestCase
3231
*/
3332
private $dataFormKey;
3433

35-
/**
36-
* @var \Closure
37-
*/
38-
private $closure;
39-
4034
protected function setUp()
4135
{
4236

@@ -55,10 +49,6 @@ protected function setUp()
5549
->disableOriginalConstructor()
5650
->setMethods(['getBeforeRequestParams', 'setBeforeRequestParams'])
5751
->getMock();
58-
59-
$this->closure = function () {
60-
return static::CLOSURE_VALUE;
61-
};
6252
}
6353

6454
/**
@@ -74,6 +64,7 @@ public function testAroundFlushFormKey(
7464
$getFormKeyTimes,
7565
$setBeforeParamsTimes
7666
) {
67+
$observerDto = new Observer();
7768
$observer = new FlushFormKey($this->cookieFormKey, $this->dataFormKey);
7869
$plugin = new CustomerFlushFormKey($this->customerSession, $this->dataFormKey);
7970

@@ -91,7 +82,11 @@ public function testAroundFlushFormKey(
9182
->method('setBeforeRequestParams')
9283
->with($beforeParams);
9384

94-
$plugin->aroundExecute($observer, $this->closure, $observer);
85+
$proceed = function ($observerDto) use ($observer) {
86+
return $observer->execute($observerDto);
87+
};
88+
89+
$plugin->aroundExecute($observer, $proceed, $observerDto);
9590
}
9691

9792
/**

0 commit comments

Comments
 (0)