Skip to content

Commit 06bcc1a

Browse files
author
Oleksandr Dubovyk
committed
Merge remote-tracking branch 'mainline/2.4-develop' into Chaika-PR24-2020-01-22
2 parents ca0266d + 332e765 commit 06bcc1a

File tree

168 files changed

+5643
-1692
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+5643
-1692
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 206 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/developer-experience-issue.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
name: Developer experience issue
33
about: Issues related to customization, extensibility, modularity
4+
labels: 'Triage: Dev.Experience'
45

56
---
67

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
name: Feature request
33
about: Please consider reporting directly to https://github.com/magento/community-features
4+
labels: 'feature request'
45

56
---
67

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
Letting us know what has changed and why it needed changing will help us validate this pull request.
1616
-->
1717

18+
### Related Pull Requests
19+
<!-- related pull request placeholder -->
20+
1821
### Fixed Issues (if relevant)
1922
<!---
2023
If relevant, please provide a list of fixed issues in the format magento/magento2#<issue_number>.
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\AdminNotification\Test\Unit\Observer;
7+
8+
use Magento\AdminNotification\Model\Feed;
9+
use Magento\AdminNotification\Model\FeedFactory;
10+
use Magento\AdminNotification\Observer\PredispatchAdminActionControllerObserver;
11+
use Magento\Backend\Model\Auth\Session;
12+
use Magento\Framework\Event\Observer;
13+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
14+
use PHPUnit\Framework\MockObject\MockObject;
15+
use PHPUnit\Framework\TestCase;
16+
17+
/**
18+
* Test class for \Magento\AdminNotification\Observer\PredispatchAdminActionControllerObserver
19+
*/
20+
class PredispatchAdminActionControllerObserverTest extends TestCase
21+
{
22+
private const STATUS_ADMIN_LOGGED_IN = true;
23+
private const STATUS_ADMIN_IS_NOT_LOGGED = false;
24+
25+
/**
26+
* @var Session|MockObject
27+
*/
28+
private $backendAuthSessionMock;
29+
30+
/**
31+
* @var Feed|MockObject
32+
*/
33+
private $feedMock;
34+
35+
/**
36+
* @var FeedFactory|MockObject
37+
*/
38+
private $feedFactoryMock;
39+
40+
/**
41+
* Object Manager Instance
42+
*
43+
* @var ObjectManager
44+
*/
45+
private $objectManager;
46+
47+
/**
48+
* Testable Object
49+
*
50+
* @var PredispatchAdminActionControllerObserver
51+
*/
52+
private $observer;
53+
54+
/**
55+
* @var Observer|MockObject
56+
*/
57+
private $observerMock;
58+
59+
/**
60+
* @inheritdoc
61+
*/
62+
protected function setUp() : void
63+
{
64+
$this->objectManager = new ObjectManager($this);
65+
$this->observerMock = $this->createMock(Observer::class);
66+
67+
$this->backendAuthSessionMock = $this->getMockBuilder(Session::class)
68+
->disableOriginalConstructor()
69+
->setMethods(['isLoggedIn'])
70+
->getMock();
71+
72+
$this->feedMock = $this->getMockBuilder(Feed::class)
73+
->disableOriginalConstructor()
74+
->setMethods(['checkUpdate'])
75+
->getMock();
76+
77+
$this->feedFactoryMock = $this->getMockBuilder(FeedFactory::class)
78+
->disableOriginalConstructor()
79+
->setMethods(['create'])
80+
->getMock();
81+
82+
$this->observer = $this->objectManager->getObject(
83+
PredispatchAdminActionControllerObserver::class,
84+
[
85+
'_feedFactory' => $this->feedFactoryMock,
86+
'_backendAuthSession' => $this->backendAuthSessionMock,
87+
]
88+
);
89+
}
90+
91+
/**
92+
* Test observer when admin user is logged in
93+
*/
94+
public function testPredispatchObserverWhenAdminLoggedIn()
95+
{
96+
$this->backendAuthSessionMock
97+
->expects($this->once())
98+
->method('isLoggedIn')
99+
->willReturn(self::STATUS_ADMIN_LOGGED_IN);
100+
101+
$this->feedFactoryMock
102+
->expects($this->once())
103+
->method('create')
104+
->willReturn($this->feedMock);
105+
106+
$this->feedMock
107+
->expects($this->once())
108+
->method('checkUpdate')
109+
->willReturn($this->feedMock);
110+
111+
$this->observer->execute($this->observerMock);
112+
}
113+
114+
/**
115+
* Test observer when admin user is not logged in
116+
*/
117+
public function testPredispatchObserverWhenAdminIsNotLoggedIn()
118+
{
119+
$this->backendAuthSessionMock
120+
->expects($this->once())
121+
->method('isLoggedIn')
122+
->willReturn(self::STATUS_ADMIN_IS_NOT_LOGGED);
123+
124+
$this->feedFactoryMock
125+
->expects($this->never())
126+
->method('create');
127+
128+
$this->feedMock
129+
->expects($this->never())
130+
->method('checkUpdate');
131+
132+
$this->observer->execute($this->observerMock);
133+
}
134+
}

app/code/Magento/Backend/Block/Media/Uploader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected function _construct()
8787

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

90-
$uploadUrl = $this->_urlBuilder->addSessionParam()->getUrl('adminhtml/*/upload');
90+
$uploadUrl = $this->_urlBuilder->getUrl('adminhtml/*/upload');
9191
$this->getConfig()->setUrl($uploadUrl);
9292
$this->getConfig()->setParams(['form_key' => $this->getFormKey()]);
9393
$this->getConfig()->setFileField('file');

app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected function _prepareLayout()
9595
);
9696

9797
$this->getUploader()->getConfig()->setUrl(
98-
$this->_urlBuilder->addSessionParam()->getUrl('catalog/product_gallery/upload')
98+
$this->_urlBuilder->getUrl('catalog/product_gallery/upload')
9999
)->setFileField(
100100
'image'
101101
)->setFilters(

0 commit comments

Comments
 (0)