Skip to content

Commit df511be

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into refactor/mftf-customer
# Conflicts: # app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerActionGroup.xml
2 parents eaeacf1 + 15b5c60 commit df511be

File tree

969 files changed

+34264
-7171
lines changed

Some content is hidden

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

969 files changed

+34264
-7171
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>.

app/code/Magento/AdminAnalytics/etc/adminhtml/system.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
99
<system>
1010
<section id="admin">
11-
<group id="usage" translate="label" type="text" sortOrder="2000" showInDefault="1" showInWebsite="0" showInStore="0">
11+
<group id="usage" translate="label" type="text" sortOrder="2000" showInDefault="1">
1212
<label>Admin Usage</label>
13-
<field id="enabled" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
13+
<field id="enabled" translate="label comment" type="select" sortOrder="1" showInDefault="1">
1414
<label>Enable Admin Usage Tracking</label>
1515
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
1616
<comment>Allow Magento to track admin usage in order to improve the quality and user experience.</comment>
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+
}

0 commit comments

Comments
 (0)