Skip to content

Commit

Permalink
Merge branch '2.4-develop' of http://github.com/magento/magento2 into…
Browse files Browse the repository at this point in the history
… fix/admin-category-tree-cache-key

� Conflicts:
�	app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php
  • Loading branch information
engcom-Echo committed May 13, 2020
2 parents 06d3e3a + 9fa16c7 commit 179a72f
Show file tree
Hide file tree
Showing 10,556 changed files with 206,455 additions and 177,385 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
68 changes: 0 additions & 68 deletions .travis.yml.sample

This file was deleted.

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 @@ -3,47 +3,43 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\AdminAnalytics\Test\Unit\Condition;

use Magento\AdminAnalytics\Model\Condition\CanViewNotification;
use Magento\AdminAnalytics\Model\ResourceModel\Viewer\Logger;
use Magento\AdminAnalytics\Model\Viewer\Log;
use Magento\Framework\App\CacheInterface;
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 MockObject|CacheInterface $cacheStorageMock */
private $cacheStorageMock;

public function setUp()
protected function setUp(): void
{
$this->cacheStorageMock = $this->getMockBuilder(CacheInterface::class)
->getMockForAbstractClass();
$this->logMock = $this->getMockBuilder(Log::class)
->getMock();
$this->viewerLoggerMock = $this->getMockBuilder(Logger::class)
->disableOriginalConstructor()
->getMock();
$this->productMetadataMock = $this->getMockBuilder(ProductMetadataInterface::class)
->disableOriginalConstructor()
->getMock();
$this->logMock = $this->createMock(Log::class);
$this->viewerLoggerMock = $this->createMock(Logger::class);
$this->productMetadataMock = $this->getMockForAbstractClass(ProductMetadataInterface::class);
$objectManager = new ObjectManager($this);
$this->canViewNotification = $objectManager->getObject(
CanViewNotification::class,
Expand Down
15 changes: 7 additions & 8 deletions app/code/Magento/AdminAnalytics/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
"php": "~7.1.3||~7.2.0||~7.3.0",
"php": "~7.3.0||~7.4.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-config": "*",
Expand All @@ -18,12 +18,11 @@
"AFL-3.0"
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Magento\\AdminAnalytics\\": ""
}
"files": [
"registration.php"
],
"psr-4": {
"Magento\\AdminAnalytics\\": ""
}
}
}

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 @@ -28,25 +29,25 @@ class ActionsTest extends TestCase
*/
private $sut;

protected function setUp() : void
protected function setUp(): void
{
parent::setUp();

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

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

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

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

$this->sut = new Actions($contextMock, $urlHelperMock);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
namespace Magento\AdminNotification\Test\Unit\Block\Grid\Renderer;

use Magento\AdminNotification\Block\Grid\Renderer\Notice;
use Magento\Backend\Block\Context;
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 @@ -26,16 +27,16 @@ class NoticeTest extends TestCase
*/
private $sut;

protected function setUp() : void
protected function setUp(): void
{
parent::setUp();

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

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

$this->sut = new Notice($contextMock);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Magento\Backend\Block\Context;
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 @@ -28,22 +28,22 @@ class SeverityTest extends TestCase
*/
private $sut;

protected function setUp() : void
protected function setUp(): void
{
parent::setUp();

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

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

$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 @@ -3,32 +3,38 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

/**
* Test class for \Magento\AdminNotification\Block\ToolbarEntry
*/
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));
$notificationList->method('getSize')->willReturn($unreadNotifications);

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

Expand All @@ -44,26 +50,21 @@ 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
)
->disableOriginalConstructor()
->getMock();
$notificationList = $this->createMock(Unread::class);

/** @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)
->will($this->returnSelf());
->with(ToolbarEntry::NOTIFICATIONS_NUMBER)->willReturnSelf();

// 3. Run tested method
$result = $model->getLatestUnreadNotifications();
Expand Down
Loading

0 comments on commit 179a72f

Please sign in to comment.