Skip to content

Commit

Permalink
Merge branch '2.4-develop' into issue/26384
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasLufinity authored Feb 6, 2020
2 parents 0cbc5b6 + 7322e87 commit 420fa1c
Show file tree
Hide file tree
Showing 265 changed files with 7,430 additions and 2,042 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
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);
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
<seeInCurrentUrl url="{{AdminLoginPage.url}}" stepKey="seeAdminLoginUrl"/>
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
</test>
</tests>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ define([
* @return {String}
*/
this.translate = function (text) {
return _data[text] ? _data[text] : text;
return typeof _data[text] === 'string' ? _data[text] : text;
};

return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ define([
*/
onError: function () {
self.showError($t('Payment ' + self.getTitle() + ' can\'t be initialized'));
self.reInitPayPal();
}
}, self.paypalButtonSelector);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminCardinalCommerceSettingsHiddenTest">
<annotations>
<stories value="Cardinal Commerce Settings"/>
<features value="CardinalCommerce"/>
<title value="CardinalCommerce settings hidden" />
<description value="CardinalCommerce config shouldn't be visible if the 3D secure is disabled for Authorize.Net."/>
Expand Down
Loading

0 comments on commit 420fa1c

Please sign in to comment.