Skip to content

Commit

Permalink
Merge branch '2.4-develop' into 2.4-develop-com-pr4
Browse files Browse the repository at this point in the history
  • Loading branch information
mykhailomatiola committed Jan 23, 2020
2 parents 12ab9ee + 3811867 commit 499612e
Show file tree
Hide file tree
Showing 34 changed files with 243 additions and 218 deletions.
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Block/Media/Uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected function _construct()

$this->setId($this->getId() . '_Uploader');

$uploadUrl = $this->_urlBuilder->addSessionParam()->getUrl('adminhtml/*/upload');
$uploadUrl = $this->_urlBuilder->getUrl('adminhtml/*/upload');
$this->getConfig()->setUrl($uploadUrl);
$this->getConfig()->setParams(['form_key' => $this->getFormKey()]);
$this->getConfig()->setFileField('file');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected function _prepareLayout()
);

$this->getUploader()->getConfig()->setUrl(
$this->_urlBuilder->addSessionParam()->getUrl('catalog/product_gallery/upload')
$this->_urlBuilder->getUrl('catalog/product_gallery/upload')
)->setFileField(
'image'
)->setFilters(
Expand Down
5 changes: 0 additions & 5 deletions app/code/Magento/Catalog/Model/Product/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,10 @@ public function getUrlInStore(\Magento\Catalog\Model\Product $product, $params =
*/
public function getProductUrl($product, $useSid = null)
{
if ($useSid === null) {
$useSid = $this->sidResolver->getUseSessionInUrl();
}

$params = [];
if (!$useSid) {
$params['_nosid'] = true;
}

return $this->getUrl($product, $params);
}

Expand Down
7 changes: 3 additions & 4 deletions app/code/Magento/Catalog/Test/Unit/Model/Product/UrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,11 @@ public function testGetUrl(
$this->assertEquals($requestPathProduct, $this->model->getUrlInStore($product, $routeParams));
break;
case 'getProductUrl':
$this->assertEquals($requestPathProduct, $this->model->getProductUrl($product, true));
$this->assertEquals($requestPathProduct, $this->model->getProductUrl($product, null));
$this->sidResolver
->expects($this->once())
->expects($this->never())
->method('getUseSessionInUrl')
->will($this->returnValue(true));
$this->assertEquals($requestPathProduct, $this->model->getProductUrl($product, null));
break;
}
}
Expand Down Expand Up @@ -212,7 +211,7 @@ public function getUrlDataProvider()
1,
1,
[],
['_direct' => '/product/url/path', '_query' => []],
['_direct' => '/product/url/path', '_query' => [], '_nosid' => true],
null,
null,
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public function __construct(
}

/**
* Constructor
*
* @return void
*/
protected function _construct()
Expand All @@ -49,7 +51,7 @@ protected function _construct()
$files[] = '*.' . $ext;
}
$this->getConfig()->setUrl(
$this->_urlBuilder->addSessionParam()->getUrl('cms/*/upload', ['type' => $type])
$this->_urlBuilder->getUrl('cms/*/upload', ['type' => $type])
)->setFileField(
'image'
)->setFilters(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ protected function getRows()
'smallImage' => '${$.provider}:${$.parentScope}.small_image',
],
'uploaderConfig' => [
'url' => $this->urlBuilder->addSessionParam()->getUrl(
'url' => $this->urlBuilder->getUrl(
'catalog/product_gallery/upload'
),
],
Expand Down
15 changes: 6 additions & 9 deletions app/code/Magento/Customer/Model/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* @method string getNoReferer()
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
* @SuppressWarnings(PHPMD.TooManyFields)
* @since 100.0.2
*/
class Session extends \Magento\Framework\Session\SessionManager
Expand Down Expand Up @@ -108,6 +109,11 @@ class Session extends \Magento\Framework\Session\SessionManager
*/
protected $response;

/**
* @var AccountConfirmation
*/
private $accountConfirmation;

/**
* Session constructor.
*
Expand Down Expand Up @@ -511,13 +517,6 @@ public function authenticate($loginUrl = null)
$this->response->setRedirect($loginUrl);
} else {
$arguments = $this->_customerUrl->getLoginUrlParams();
if ($this->_createUrl()->getUseSession()) {
$arguments += [
'_query' => [
$this->sidResolver->getSessionIdQueryParam($this->_session) => $this->_session->getSessionId(),
]
];
}
$this->response->setRedirect(
$this->_createUrl()->getUrl(\Magento\Customer\Model\Url::ROUTE_ACCOUNT_LOGIN, $arguments)
);
Expand All @@ -535,8 +534,6 @@ public function authenticate($loginUrl = null)
*/
protected function _setAuthUrl($key, $url)
{
$url = $this->_coreUrl->removeRequestParam($url, $this->sidResolver->getSessionIdQueryParam($this));
// Add correct session ID to URL if needed
$url = $this->_createUrl()->getRebuiltUrl($url);
return $this->storage->setData($key, $url);
}
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Customer/Test/Unit/Model/SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ public function testAuthenticate()
$urlMock->expects($this->once())
->method('getRebuiltUrl')
->willReturn('');
$this->urlFactoryMock->expects($this->exactly(4))
$this->urlFactoryMock->expects($this->exactly(3))
->method('create')
->willReturn($urlMock);
$urlMock->expects($this->once())
$urlMock->expects($this->never())
->method('getUseSession')
->willReturn(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @author Magento Core Team <core@magentocommerce.com>
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
* @deprecated
* @deprecated in favor of new class which adds grid links
* @see \Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\Links
*/
class Links extends \Magento\Backend\Block\Template
Expand Down Expand Up @@ -398,7 +398,7 @@ public function getFileFieldName($type)
*/
public function getUploadUrl($type)
{
return $this->_urlFactory->create()->addSessionParam()->getUrl(
return $this->_urlFactory->create()->getUrl(
'adminhtml/downloadable_file/upload',
['type' => $type, '_secure' => true]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @author Magento Core Team <core@magentocommerce.com>
*
* @deprecated
* @deprecated because of new class which adds grids samples
* @see \Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\Samples
*/
class Samples extends \Magento\Backend\Block\Widget
Expand Down Expand Up @@ -250,7 +250,7 @@ public function getUploadButtonHtml()
*/
public function getConfigJson()
{
$url = $this->_urlFactory->create()->addSessionParam()->getUrl(
$url = $this->_urlFactory->create()->getUrl(
'adminhtml/downloadable_file/upload',
['type' => 'samples', '_secure' => true]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Magento\Framework\Stdlib\ArrayManager;

/**
* Class LinksTest
* Test for class Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\Links
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class LinksTest extends \PHPUnit\Framework\TestCase
Expand Down Expand Up @@ -169,7 +169,7 @@ public function testModifyMeta()
->method('toOptionArray');
$this->shareableMock->expects($this->once())
->method('toOptionArray');
$this->urlBuilderMock->expects($this->exactly(2))
$this->urlBuilderMock->expects($this->never())
->method('addSessionParam')
->willReturnSelf();
$this->urlBuilderMock->expects($this->exactly(2))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Magento\Framework\Stdlib\ArrayManager;

/**
* Class SamplesTest
* Test for class Magento\Downloadable\Ui\DataProvider\Product\Form\Modifier\Samples
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class SamplesTest extends \PHPUnit\Framework\TestCase
Expand Down Expand Up @@ -141,7 +141,7 @@ public function testModifyMeta()
->method('isSingleStoreMode');
$this->typeUploadMock->expects($this->once())
->method('toOptionArray');
$this->urlBuilderMock->expects($this->once())
$this->urlBuilderMock->expects($this->never())
->method('addSessionParam')
->willReturnSelf();
$this->urlBuilderMock->expects($this->once())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Magento\Framework\Exception\ValidatorException;

/**
* Class Links
* Grid class to add links
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Links
Expand Down Expand Up @@ -162,7 +162,7 @@ protected function addSampleFile(array $linkData, LinkInterface $link)
'name' => $this->downloadableFile->getFileFromPathFile($sampleFile),
'size' => $this->downloadableFile->getFileSize($file),
'status' => 'old',
'url' => $this->urlBuilder->addSessionParam()->getUrl(
'url' => $this->urlBuilder->getUrl(
'adminhtml/downloadable_product_edit/link',
['id' => $link->getId(), 'type' => 'sample', '_secure' => true]
),
Expand Down Expand Up @@ -191,7 +191,7 @@ protected function addLinkFile(array $linkData, LinkInterface $link)
'name' => $this->downloadableFile->getFileFromPathFile($linkFile),
'size' => $this->downloadableFile->getFileSize($file),
'status' => 'old',
'url' => $this->urlBuilder->addSessionParam()->getUrl(
'url' => $this->urlBuilder->getUrl(
'adminhtml/downloadable_product_edit/link',
['id' => $link->getId(), 'type' => 'link', '_secure' => true]
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Magento\Downloadable\Api\Data\SampleInterface;

/**
* Class Samples
* Class to add samples
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Samples
Expand Down Expand Up @@ -143,7 +143,7 @@ protected function addSampleFile(array $sampleData, SampleInterface $sample)
'name' => $this->downloadableFile->getFileFromPathFile($sampleFile),
'size' => $this->downloadableFile->getFileSize($file),
'status' => 'old',
'url' => $this->urlBuilder->addSessionParam()->getUrl(
'url' => $this->urlBuilder->getUrl(
'adminhtml/downloadable_product_edit/sample',
['id' => $sample->getId(), '_secure' => true]
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ protected function getFileColumn()
'elementTmpl' => 'Magento_Downloadable/components/file-uploader',
'fileInputName' => 'links',
'uploaderConfig' => [
'url' => $this->urlBuilder->addSessionParam()->getUrl(
'url' => $this->urlBuilder->getUrl(
'adminhtml/downloadable_file/upload',
['type' => 'links', '_secure' => true]
),
Expand Down Expand Up @@ -406,7 +406,7 @@ protected function getSampleColumn()
'fileInputName' => 'link_samples',
'labelVisible' => false,
'uploaderConfig' => [
'url' => $this->urlBuilder->addSessionParam()->getUrl(
'url' => $this->urlBuilder->getUrl(
'adminhtml/downloadable_file/upload',
['type' => 'link_samples', '_secure' => true]
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ protected function getSampleColumn()
'elementTmpl' => 'Magento_Downloadable/components/file-uploader',
'fileInputName' => 'samples',
'uploaderConfig' => [
'url' => $this->urlBuilder->addSessionParam()->getUrl(
'url' => $this->urlBuilder->getUrl(
'adminhtml/downloadable_file/upload',
['type' => 'samples', '_secure' => true]
),
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Email/Model/AbstractTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ public function loadDefault($templateId)
public function getProcessedTemplate(array $variables = [])
{
$processor = $this->getTemplateFilter()
->setUseSessionInUrl(false)
->setPlainTemplateMode($this->isPlain())
->setIsChildTemplate($this->isChildTemplate())
->setTemplateProcessor([$this, 'getTemplateContent']);
Expand Down
10 changes: 2 additions & 8 deletions app/code/Magento/Email/Test/Unit/Model/AbstractTemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ protected function setUp()
$this->design = $this->getMockBuilder(\Magento\Framework\View\DesignInterface::class)
->disableOriginalConstructor()
->getMock();
$this->registry = $this->getMockBuilder(\Magento\Framework\Registry::class)
->disableOriginalConstructor()
->getMock();
$this->appEmulation = $this->getMockBuilder(\Magento\Store\Model\App\Emulation::class)
->disableOriginalConstructor()
->getMock();
Expand Down Expand Up @@ -177,7 +174,7 @@ public function testGetProcessedTemplate($variables, $templateType, $storeId, $e
->disableOriginalConstructor()
->getMock();

$filterTemplate->expects($this->once())
$filterTemplate->expects($this->never())
->method('setUseSessionInUrl')
->with(false)
->will($this->returnSelf());
Expand Down Expand Up @@ -253,7 +250,6 @@ public function testGetProcessedTemplateException()
$filterTemplate = $this->getMockBuilder(\Magento\Email\Model\Template\Filter::class)
->setMethods(
[
'setUseSessionInUrl',
'setPlainTemplateMode',
'setIsChildTemplate',
'setDesignParams',
Expand All @@ -267,9 +263,7 @@ public function testGetProcessedTemplateException()
)
->disableOriginalConstructor()
->getMock();
$filterTemplate->expects($this->once())
->method('setUseSessionInUrl')
->will($this->returnSelf());

$filterTemplate->expects($this->once())
->method('setPlainTemplateMode')
->will($this->returnSelf());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class_exists(\Magento\Newsletter\Model\Template\Filter::class, true);
)
->disableOriginalConstructor()
->getMock();
$filterTemplate->expects($this->once())
$filterTemplate->expects($this->never())
->method('setUseSessionInUrl')
->with(false)
->will($this->returnSelf());
Expand Down
Loading

0 comments on commit 499612e

Please sign in to comment.