Skip to content

Commit

Permalink
Merge branch '2.4-develop' into fix_cloning_quote_billing_addres_street
Browse files Browse the repository at this point in the history
  • Loading branch information
slavvka committed Feb 10, 2020
2 parents 4e81fd8 + 1027e02 commit 974f5e9
Show file tree
Hide file tree
Showing 971 changed files with 34,121 additions and 7,172 deletions.
206 changes: 0 additions & 206 deletions .github/CODEOWNERS

This file was deleted.

1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/developer-experience-issue.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Developer experience issue
about: Issues related to customization, extensibility, modularity
labels: 'Triage: Dev.Experience'

---

Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Feature request
about: Please consider reporting directly to https://github.com/magento/community-features
labels: 'feature request'

---

Expand Down
3 changes: 3 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
Letting us know what has changed and why it needed changing will help us validate this pull request.
-->

### Related Pull Requests
<!-- related pull request placeholder -->

### Fixed Issues (if relevant)
<!---
If relevant, please provide a list of fixed issues in the format magento/magento2#<issue_number>.
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/AdminAnalytics/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="admin">
<group id="usage" translate="label" type="text" sortOrder="2000" showInDefault="1" showInWebsite="0" showInStore="0">
<group id="usage" translate="label" type="text" sortOrder="2000" showInDefault="1">
<label>Admin Usage</label>
<field id="enabled" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
<field id="enabled" translate="label comment" type="select" sortOrder="1" showInDefault="1">
<label>Enable Admin Usage Tracking</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment>Allow Magento to track admin usage in order to improve the quality and user experience.</comment>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\AdminNotification\Test\Unit\Observer;

use Magento\AdminNotification\Model\Feed;
use Magento\AdminNotification\Model\FeedFactory;
use Magento\AdminNotification\Observer\PredispatchAdminActionControllerObserver;
use Magento\Backend\Model\Auth\Session;
use Magento\Framework\Event\Observer;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
* Test class for \Magento\AdminNotification\Observer\PredispatchAdminActionControllerObserver
*/
class PredispatchAdminActionControllerObserverTest extends TestCase
{
private const STATUS_ADMIN_LOGGED_IN = true;
private const STATUS_ADMIN_IS_NOT_LOGGED = false;

/**
* @var Session|MockObject
*/
private $backendAuthSessionMock;

/**
* @var Feed|MockObject
*/
private $feedMock;

/**
* @var FeedFactory|MockObject
*/
private $feedFactoryMock;

/**
* Object Manager Instance
*
* @var ObjectManager
*/
private $objectManager;

/**
* Testable Object
*
* @var PredispatchAdminActionControllerObserver
*/
private $observer;

/**
* @var Observer|MockObject
*/
private $observerMock;

/**
* @inheritdoc
*/
protected function setUp() : void
{
$this->objectManager = new ObjectManager($this);
$this->observerMock = $this->createMock(Observer::class);

$this->backendAuthSessionMock = $this->getMockBuilder(Session::class)
->disableOriginalConstructor()
->setMethods(['isLoggedIn'])
->getMock();

$this->feedMock = $this->getMockBuilder(Feed::class)
->disableOriginalConstructor()
->setMethods(['checkUpdate'])
->getMock();

$this->feedFactoryMock = $this->getMockBuilder(FeedFactory::class)
->disableOriginalConstructor()
->setMethods(['create'])
->getMock();

$this->observer = $this->objectManager->getObject(
PredispatchAdminActionControllerObserver::class,
[
'_feedFactory' => $this->feedFactoryMock,
'_backendAuthSession' => $this->backendAuthSessionMock,
]
);
}

/**
* Test observer when admin user is logged in
*/
public function testPredispatchObserverWhenAdminLoggedIn()
{
$this->backendAuthSessionMock
->expects($this->once())
->method('isLoggedIn')
->willReturn(self::STATUS_ADMIN_LOGGED_IN);

$this->feedFactoryMock
->expects($this->once())
->method('create')
->willReturn($this->feedMock);

$this->feedMock
->expects($this->once())
->method('checkUpdate')
->willReturn($this->feedMock);

$this->observer->execute($this->observerMock);
}

/**
* Test observer when admin user is not logged in
*/
public function testPredispatchObserverWhenAdminIsNotLoggedIn()
{
$this->backendAuthSessionMock
->expects($this->once())
->method('isLoggedIn')
->willReturn(self::STATUS_ADMIN_IS_NOT_LOGGED);

$this->feedFactoryMock
->expects($this->never())
->method('create');

$this->feedMock
->expects($this->never())
->method('checkUpdate');

$this->observer->execute($this->observerMock);
}
}
Loading

0 comments on commit 974f5e9

Please sign in to comment.