Skip to content

Commit 5b5f519

Browse files
author
Roman Leshchenko
committed
Merge branch 'MAGETWO-72050' of github.com:magento-qwerty/magento2ce into MAGETWO-72050
2 parents ff8cd12 + e3aa98c commit 5b5f519

File tree

6 files changed

+4
-93
lines changed

6 files changed

+4
-93
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Category/Image/Upload.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,6 @@ public function execute()
5353
$imageId = $this->_request->getParam('param_name', 'image');
5454
try {
5555
$result = $this->imageUploader->saveFileToTmpDir($imageId);
56-
57-
$result['cookie'] = [
58-
'name' => $this->_getSession()->getName(),
59-
'value' => $this->_getSession()->getSessionId(),
60-
'lifetime' => $this->_getSession()->getCookieLifetime(),
61-
'path' => $this->_getSession()->getCookiePath(),
62-
'domain' => $this->_getSession()->getCookieDomain(),
63-
];
6456
} catch (\Exception $e) {
6557
$result = ['error' => $e->getMessage(), 'errorcode' => $e->getCode()];
6658
}

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Category/Image/UploadTest.php

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,6 @@ protected function setUp()
4545
*/
4646
public function testExecute($name, $savedName)
4747
{
48-
$cookieName = 'testName';
49-
$sessionId = 'testSessionId';
50-
$lifetime = 'testLifetime';
51-
$path = 'testPath';
52-
$domain = 'testDomain';
53-
$data = [
54-
'cookie' => [
55-
'name' => $cookieName,
56-
'value' => $sessionId,
57-
'lifetime' => $lifetime,
58-
'path' => $path,
59-
'domain' => $domain
60-
]
61-
];
6248
$request = $this->objectManager->getObject(Request::class);
6349
$uploader = $this->getMockBuilder(ImageUploader::class)
6450
->disableOriginalConstructor()
@@ -71,37 +57,19 @@ public function testExecute($name, $savedName)
7157
$resultFactory->expects($this->once())
7258
->method('create')
7359
->will($this->returnValue(new DataObject()));
74-
$session = $this->getMockBuilder(\Magento\Backend\Model\Session::class)
75-
->disableOriginalConstructor()
76-
->getMock();
77-
$session->expects($this->once())
78-
->method('getName')
79-
->willReturn($cookieName);
80-
$session->expects($this->once())
81-
->method('getSessionId')
82-
->willReturn($sessionId);
83-
$session->expects($this->once())
84-
->method('getCookieLifeTime')
85-
->willReturn($lifetime);
86-
$session->expects($this->once())
87-
->method('getCookiePath')
88-
->willReturn($path);
89-
$session->expects($this->once())
90-
->method('getCookieDomain')
91-
->willReturn($domain);
60+
9261
$model = $this->objectManager->getObject(Model::class, [
9362
'request' => $request,
9463
'resultFactory' => $resultFactory,
95-
'imageUploader' => $uploader,
96-
'_session' => $session
64+
'imageUploader' => $uploader
9765
]);
9866
$uploader->expects($this->once())
9967
->method('saveFileToTmpDir')
10068
->with($savedName)
10169
->will($this->returnValue([]));
10270
$request->setParam('param_name', $name);
10371
$result = $model->execute();
104-
$this->assertSame($data, $result->getData());
72+
$this->assertSame([], $result->getData());
10573
}
10674

10775
/**

app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -496,14 +496,6 @@ public function uploadFile($targetPath, $type = null)
496496
// create thumbnail
497497
$this->resizeFile($targetPath . '/' . $uploader->getUploadedFileName(), true);
498498

499-
$result['cookie'] = [
500-
'name' => $this->getSession()->getName(),
501-
'value' => $this->getSession()->getSessionId(),
502-
'lifetime' => $this->getSession()->getCookieLifetime(),
503-
'path' => $this->getSession()->getCookiePath(),
504-
'domain' => $this->getSession()->getCookieDomain(),
505-
];
506-
507499
return $result;
508500
}
509501

app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -471,14 +471,7 @@ public function testUploadFile()
471471
$thumbnailDestination = $thumbnailTargetPath . '/' . $fileName;
472472
$type = 'image';
473473
$result = [
474-
'result',
475-
'cookie' => [
476-
'name' => 'session_name',
477-
'value' => '1',
478-
'lifetime' => '50',
479-
'path' => 'cookie/path',
480-
'domain' => 'cookie_domain',
481-
],
474+
'result'
482475
];
483476
$uploader = $this->getMockBuilder(\Magento\MediaStorage\Model\File\Uploader::class)
484477
->disableOriginalConstructor()
@@ -538,17 +531,6 @@ public function testUploadFile()
538531

539532
$this->adapterFactoryMock->expects($this->atLeastOnce())->method('create')->willReturn($image);
540533

541-
$this->sessionMock->expects($this->atLeastOnce())->method('getName')
542-
->willReturn($result['cookie']['name']);
543-
$this->sessionMock->expects($this->atLeastOnce())->method('getSessionId')
544-
->willReturn($result['cookie']['value']);
545-
$this->sessionMock->expects($this->atLeastOnce())->method('getCookieLifetime')
546-
->willReturn($result['cookie']['lifetime']);
547-
$this->sessionMock->expects($this->atLeastOnce())->method('getCookiePath')
548-
->willReturn($result['cookie']['path']);
549-
$this->sessionMock->expects($this->atLeastOnce())->method('getCookieDomain')
550-
->willReturn($result['cookie']['domain']);
551-
552534
$this->assertEquals($result, $this->imagesStorage->uploadFile($targetPath, $type));
553535
}
554536
}

app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/File/Upload.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,6 @@ public function execute()
9797
$this->storageDatabase->saveFile($relativePath);
9898
}
9999

100-
$result['cookie'] = [
101-
'name' => $this->_getSession()->getName(),
102-
'value' => $this->_getSession()->getSessionId(),
103-
'lifetime' => $this->_getSession()->getCookieLifetime(),
104-
'path' => $this->_getSession()->getCookiePath(),
105-
'domain' => $this->_getSession()->getCookieDomain(),
106-
];
107100
} catch (\Exception $e) {
108101
$result = ['error' => $e->getMessage(), 'errorcode' => $e->getCode()];
109102
}

app/code/Magento/Downloadable/Test/Unit/Controller/Adminhtml/Downloadable/File/UploadTest.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ class UploadTest extends \PHPUnit_Framework_TestCase
5656
*/
5757
protected $fileHelper;
5858

59-
/**
60-
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\Model\Session
61-
*/
62-
protected $session;
63-
6459
/**
6560
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Controller\ResultFactory
6661
*/
@@ -78,9 +73,6 @@ protected function setUp()
7873
->disableOriginalConstructor()
7974
->setMethods(['create'])
8075
->getMock();
81-
$this->session = $this->getMockBuilder('\Magento\Backend\Model\Session')
82-
->disableOriginalConstructor()
83-
->getMock();
8476
$this->resultFactory = $this->getMockBuilder('\Magento\Framework\Controller\ResultFactory')
8577
->disableOriginalConstructor()
8678
->setMethods(['create'])
@@ -111,9 +103,6 @@ protected function setUp()
111103
$this->context->expects($this->any())
112104
->method('getRequest')
113105
->will($this->returnValue($this->request));
114-
$this->context->expects($this->any())
115-
->method('getSession')
116-
->will($this->returnValue($this->session));
117106
$this->context->expects($this->any())
118107
->method('getResultFactory')
119108
->will($this->returnValue($this->resultFactory));
@@ -157,11 +146,6 @@ public function testExecute()
157146
$this->uploaderFactory->expects($this->once())->method('create')->willReturn($uploader);
158147
$this->fileHelper->expects($this->once())->method('uploadFromTmp')->willReturn($data);
159148
$this->storageDatabase->expects($this->once())->method('saveFile');
160-
$this->session->expects($this->once())->method('getName')->willReturn('Name');
161-
$this->session->expects($this->once())->method('getSessionId')->willReturn('SessionId');
162-
$this->session->expects($this->once())->method('getCookieLifetime')->willReturn('CookieLifetime');
163-
$this->session->expects($this->once())->method('getCookiePath')->willReturn('CookiePath');
164-
$this->session->expects($this->once())->method('getCookieDomain')->willReturn('CookieDomain');
165149
$this->resultFactory->expects($this->once())->method('create')->willReturn($resultJson);
166150
$resultJson->expects($this->once())->method('setData')->willReturnSelf();
167151

0 commit comments

Comments
 (0)