Skip to content

Commit

Permalink
Merge branch '2.4-develop' into defer-js
Browse files Browse the repository at this point in the history
  • Loading branch information
ihor-sviziev committed Apr 15, 2020
2 parents 08f2bd4 + 985c679 commit 2c5bc50
Show file tree
Hide file tree
Showing 3,386 changed files with 67,747 additions and 81,392 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If you are a new GitHub user, we recommend that you create your own [free github
This will allow you to collaborate with the Magento 2 development team, fork the Magento 2 project and send pull requests.

1. Search current [listed issues](https://github.com/magento/magento2/issues) (open or closed) for similar proposals of intended contribution before starting work on a new contribution.
2. Review the [Contributor License Agreement](https://magento.com/legaldocuments/mca) if this is your first time contributing.
2. Review the [Contributor License Agreement](https://opensource.adobe.com/cla.html) if this is your first time contributing.
3. Create and test your work.
4. Fork the Magento 2 repository according to the [Fork A Repository instructions](https://devdocs.magento.com/guides/v2.3/contributor-guide/contributing.html#fork) and when you are ready to send us a pull request – follow the [Create A Pull Request instructions](https://devdocs.magento.com/guides/v2.3/contributor-guide/contributing.html#pull_request).
5. Once your contribution is received the Magento 2 development team will review the contribution and collaborate with you as needed.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
</annotations>

<!-- Logging in Magento admin -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,27 @@
use Magento\Framework\App\ProductMetadataInterface;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\Framework\App\CacheInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
* Class CanViewNotificationTest
*/
class CanViewNotificationTest extends \PHPUnit\Framework\TestCase
class CanViewNotificationTest extends TestCase
{
/** @var CanViewNotification */
private $canViewNotification;

/** @var Logger|\PHPUnit_Framework_MockObject_MockObject */
/** @var Logger|MockObject */
private $viewerLoggerMock;

/** @var ProductMetadataInterface|\PHPUnit_Framework_MockObject_MockObject */
/** @var ProductMetadataInterface|MockObject */
private $productMetadataMock;

/** @var Log|\PHPUnit_Framework_MockObject_MockObject */
/** @var Log|MockObject */
private $logMock;

/** @var $cacheStorageMock \PHPUnit_Framework_MockObject_MockObject|CacheInterface */
/** @var $cacheStorageMock MockObject|CacheInterface */
private $cacheStorageMock;

public function setUp()
protected function setUp(): void
{
$this->cacheStorageMock = $this->getMockBuilder(CacheInterface::class)
->getMockForAbstractClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<group value="mtf_migrated"/>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
<actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/>
</before>
<after>
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Magento\Framework\Escaper;
use Magento\Framework\Url\Helper\Data;
use Magento\Framework\UrlInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class ActionsTest extends TestCase
Expand All @@ -32,20 +33,20 @@ protected function setUp() : void
{
parent::setUp();

/** @var Escaper | \PHPUnit_Framework_MockObject_MockObject $escaperMock */
/** @var Escaper|MockObject $escaperMock */
$escaperMock = $this->getMockBuilder(Escaper::class)->disableOriginalConstructor()->getMock();
$escaperMock->expects($this->once())->method('escapeUrl')->willReturn('https://magento.com');

/** @var UrlInterface | \PHPUnit_Framework_MockObject_MockObject $urlBuilder */
/** @var UrlInterface|MockObject $urlBuilder */
$urlBuilder = $this->getMockBuilder(UrlInterface::class)->getMock();
$urlBuilder->expects($this->once())->method('getUrl')->willReturn('http://magento.com');

/** @var Context | \PHPUnit_Framework_MockObject_MockObject $contextMock */
/** @var Context|MockObject $contextMock */
$contextMock = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock();
$contextMock->expects($this->once())->method('getEscaper')->willReturn($escaperMock);
$contextMock->expects($this->once())->method('getUrlBuilder')->willReturn($urlBuilder);

/** @var Data | \PHPUnit_Framework_MockObject_MockObject $urlHelperMock */
/** @var Data|MockObject $urlHelperMock */
$urlHelperMock = $this->getMockBuilder(Data::class)->disableOriginalConstructor()->getMock();
$urlHelperMock->expects($this->once())->method('getEncodedUrl')->willReturn('http://magento.com');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Magento\Framework\DataObject;
use Magento\Framework\Escaper;
use Magento\Backend\Block\Context;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class NoticeTest extends TestCase
Expand All @@ -30,11 +31,11 @@ protected function setUp() : void
{
parent::setUp();

/** @var Escaper | \PHPUnit_Framework_MockObject_MockObject $escaperMock */
/** @var Escaper|MockObject $escaperMock */
$escaperMock = $this->getMockBuilder(Escaper::class)->disableOriginalConstructor()->getMock();
$escaperMock->expects($this->exactly(2))->method('escapeHtml')->willReturn('<div>Some random html</div>');

/** @var Context | \PHPUnit_Framework_MockObject_MockObject $contextMock */
/** @var Context|MockObject $contextMock */
$contextMock = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock();
$contextMock->expects($this->once())->method('getEscaper')->willReturn($escaperMock);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Magento\Backend\Block\Widget\Grid\Column;
use Magento\Framework\DataObject;
use Magento\Framework\Escaper;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class SeverityTest extends TestCase
Expand All @@ -32,18 +33,18 @@ protected function setUp() : void
{
parent::setUp();

/** @var Inbox |\PHPUnit_Framework_MockObject_MockObject $inboxMock */
/** @var Inbox|MockObject $inboxMock */
$inboxMock = $this->getMockBuilder(Inbox::class)->disableOriginalConstructor()->getMock();

/** @var Context | \PHPUnit_Framework_MockObject_MockObject $contextMock */
/** @var Context|MockObject $contextMock */
$contextMock = $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock();

$this->sut = new Severity($contextMock, $inboxMock);
}

public function testShouldRenderSeverity() : void
{
/** @var Column | \PHPUnit_Framework_MockObject_MockObject $columnMock */
/** @var Column|MockObject $columnMock */
$columnMock = $this->getMockBuilder(Column::class)
->disableOriginalConstructor()
->setMethods(['getIndex'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,31 @@
*/
namespace Magento\AdminNotification\Test\Unit\Block;

class ToolbarEntryTest extends \PHPUnit\Framework\TestCase
use Magento\AdminNotification\Block\ToolbarEntry;
use Magento\AdminNotification\Model\ResourceModel\Inbox\Collection\Unread;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use PHPUnit\Framework\TestCase;

class ToolbarEntryTest extends TestCase
{
/**
* Retrieve toolbar entry block instance
*
* @param int $unreadNotifications number of unread notifications
* @return \Magento\AdminNotification\Block\ToolbarEntry
* @return ToolbarEntry
*/
protected function _getBlockInstance($unreadNotifications)
{
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$objectManagerHelper = new ObjectManager($this);
// mock collection of unread notifications
$notificationList = $this->createPartialMock(
\Magento\AdminNotification\Model\ResourceModel\Inbox\Collection\Unread::class,
Unread::class,
['getSize', 'setCurPage', 'setPageSize']
);
$notificationList->expects($this->any())->method('getSize')->will($this->returnValue($unreadNotifications));

$block = $objectManagerHelper->getObject(
\Magento\AdminNotification\Block\ToolbarEntry::class,
ToolbarEntry::class,
['notificationList' => $notificationList]
);

Expand All @@ -44,25 +49,23 @@ public function testGetUnreadNotificationCount()

public function testGetLatestUnreadNotifications()
{
$helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$helper = new ObjectManager($this);

// 1. Create mocks
$notificationList = $this->getMockBuilder(
\Magento\AdminNotification\Model\ResourceModel\Inbox\Collection\Unread::class
)
$notificationList = $this->getMockBuilder(Unread::class)
->disableOriginalConstructor()
->getMock();

/** @var \Magento\AdminNotification\Block\ToolbarEntry $model */
/** @var ToolbarEntry $model */
$model = $helper->getObject(
\Magento\AdminNotification\Block\ToolbarEntry::class,
ToolbarEntry::class,
['notificationList' => $notificationList]
);

// 2. Set expectations
$notificationList->expects($this->atLeastOnce())
->method('setPageSize')
->with(\Magento\AdminNotification\Block\ToolbarEntry::NOTIFICATIONS_NUMBER)
->with(ToolbarEntry::NOTIFICATIONS_NUMBER)
->will($this->returnSelf());

// 3. Run tested method
Expand Down
61 changes: 37 additions & 24 deletions app/code/Magento/AdminNotification/Test/Unit/Model/FeedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,74 +6,87 @@

namespace Magento\AdminNotification\Test\Unit\Model;

use Magento\AdminNotification\Model\Feed;
use Magento\AdminNotification\Model\Inbox;
use Magento\AdminNotification\Model\InboxFactory;
use Magento\Backend\App\ConfigInterface;
use Magento\Framework\App\CacheInterface;
use Magento\Framework\App\DeploymentConfig;
use Magento\Framework\App\ProductMetadata;
use Magento\Framework\App\State;
use Magento\Framework\Config\ConfigOptionsListConstants;
use Magento\Framework\HTTP\Adapter\Curl;
use Magento\Framework\HTTP\Adapter\CurlFactory;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
use Magento\Framework\UrlInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class FeedTest extends \PHPUnit\Framework\TestCase
class FeedTest extends TestCase
{
/** @var \Magento\AdminNotification\Model\Feed */
/** @var Feed */
protected $feed;

/** @var ObjectManagerHelper */
protected $objectManagerHelper;

/** @var \Magento\AdminNotification\Model\InboxFactory|\PHPUnit_Framework_MockObject_MockObject */
/** @var InboxFactory|MockObject */
protected $inboxFactory;

/** @var \Magento\AdminNotification\Model\Inbox|\PHPUnit_Framework_MockObject_MockObject */
/** @var Inbox|MockObject */
protected $inboxModel;

/** @var \Magento\Framework\HTTP\Adapter\CurlFactory|\PHPUnit_Framework_MockObject_MockObject */
/** @var CurlFactory|MockObject */
protected $curlFactory;

/** @var \Magento\Framework\HTTP\Adapter\Curl|\PHPUnit_Framework_MockObject_MockObject */
/** @var Curl|MockObject */
protected $curl;

/** @var \Magento\Backend\App\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject */
/** @var ConfigInterface|MockObject */
protected $backendConfig;

/** @var \Magento\Framework\App\CacheInterface|\PHPUnit_Framework_MockObject_MockObject */
/** @var CacheInterface|MockObject */
protected $cacheManager;

/** @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject */
/** @var State|MockObject */
protected $appState;

/** @var \Magento\Framework\App\DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject */
/** @var DeploymentConfig|MockObject */
protected $deploymentConfig;

/** @var \Magento\Framework\App\ProductMetadata|\PHPUnit_Framework_MockObject_MockObject */
/** @var ProductMetadata|MockObject */
protected $productMetadata;

/** @var \Magento\Framework\UrlInterface|\PHPUnit_Framework_MockObject_MockObject */
/** @var UrlInterface|MockObject */
protected $urlBuilder;

protected function setUp()
protected function setUp(): void
{
$this->inboxFactory = $this->createPartialMock(
\Magento\AdminNotification\Model\InboxFactory::class,
InboxFactory::class,
['create']
);
$this->curlFactory = $this->createPartialMock(\Magento\Framework\HTTP\Adapter\CurlFactory::class, ['create']);
$this->curl = $this->getMockBuilder(\Magento\Framework\HTTP\Adapter\Curl::class)
$this->curlFactory = $this->createPartialMock(CurlFactory::class, ['create']);
$this->curl = $this->getMockBuilder(Curl::class)
->disableOriginalConstructor()->getMock();
$this->appState = $this->createPartialMock(\Magento\Framework\App\State::class, ['getInstallDate']);
$this->inboxModel = $this->createPartialMock(\Magento\AdminNotification\Model\Inbox::class, [
$this->appState = $this->createPartialMock(State::class, []);
$this->inboxModel = $this->createPartialMock(Inbox::class, [
'__wakeup',
'parse'
]);
$this->backendConfig = $this->createPartialMock(
\Magento\Backend\App\ConfigInterface::class,
ConfigInterface::class,
[
'getValue',
'setValue',
'isSetFlag'
]
);
$this->cacheManager = $this->createPartialMock(
\Magento\Framework\App\CacheInterface::class,
CacheInterface::class,
[
'load',
'getFrontend',
Expand All @@ -83,18 +96,18 @@ protected function setUp()
]
);

$this->deploymentConfig = $this->getMockBuilder(\Magento\Framework\App\DeploymentConfig::class)
$this->deploymentConfig = $this->getMockBuilder(DeploymentConfig::class)
->disableOriginalConstructor()->getMock();

$this->objectManagerHelper = new ObjectManagerHelper($this);

$this->productMetadata = $this->getMockBuilder(\Magento\Framework\App\ProductMetadata::class)
$this->productMetadata = $this->getMockBuilder(ProductMetadata::class)
->disableOriginalConstructor()->getMock();

$this->urlBuilder = $this->createMock(\Magento\Framework\UrlInterface::class);
$this->urlBuilder = $this->createMock(UrlInterface::class);

$this->feed = $this->objectManagerHelper->getObject(
\Magento\AdminNotification\Model\Feed::class,
Feed::class,
[
'backendConfig' => $this->backendConfig,
'cacheManager' => $this->cacheManager,
Expand Down
Loading

0 comments on commit 2c5bc50

Please sign in to comment.