Skip to content

Commit da06bd3

Browse files
committed
MAGETWO-57580: [Backport] - Csrf delete the customer addresses for 2.0.x
- code cleanup for the unit test to remove usage of context
1 parent 66ae67e commit da06bd3

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

app/code/Magento/Customer/Test/Unit/Controller/Address/DeleteTest.php

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,16 @@ protected function setUp()
6969
$this->resultRedirect = $this->getMockBuilder(\Magento\Framework\Controller\Result\Redirect::class)
7070
->disableOriginalConstructor()
7171
->getMock();
72+
$this->request = $this->getMockBuilder(\Magento\Framework\App\RequestInterface::class)
73+
->getMockForAbstractClass();
7274

7375
$objectManager = new ObjectManagerHelper($this);
74-
$this->prepareContext();
7576
$this->model = $objectManager->getObject(
7677
Delete::class,
7778
[
78-
'context' => $this->context,
79+
'request' => $this->request,
80+
'resultRedirectFactory' => $this->resultRedirectFactory,
81+
'messageManager' => $this->messageManager,
7982
'customerSession' => $this->sessionMock,
8083
'formKeyValidator' => $this->validatorMock,
8184
'formFactory' => $formFactoryMock,
@@ -84,25 +87,6 @@ protected function setUp()
8487
);
8588
}
8689

87-
protected function prepareContext()
88-
{
89-
$this->context = $this->getMockBuilder(\Magento\Framework\App\Action\Context::class)
90-
->disableOriginalConstructor()
91-
->getMock();
92-
$this->request = $this->getMockBuilder(\Magento\Framework\App\RequestInterface::class)
93-
->getMockForAbstractClass();
94-
95-
$this->context->expects($this->any())
96-
->method('getRequest')
97-
->willReturn($this->request);
98-
$this->context->expects($this->any())
99-
->method('getResultRedirectFactory')
100-
->willReturn($this->resultRedirectFactory);
101-
$this->context->expects($this->any())
102-
->method('getMessageManager')
103-
->willReturn($this->messageManager);
104-
}
105-
10690
public function testExecute()
10791
{
10892
$addressId = 1;

0 commit comments

Comments
 (0)