Skip to content

Commit c562d96

Browse files
committed
Merge branch '2.3-develop' into MC-40591
2 parents 0737c79 + caa85f3 commit c562d96

File tree

6,534 files changed

+46664
-45023
lines changed

Some content is hidden

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

6,534 files changed

+46664
-45023
lines changed

app/code/Magento/AdminAnalytics/Test/Unit/Condition/CanViewNotificationTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,26 @@
1313
use Magento\Framework\App\CacheInterface;
1414

1515
/**
16-
* Class CanViewNotificationTest
16+
* Test of CanViewNotification
1717
*/
1818
class CanViewNotificationTest extends \PHPUnit\Framework\TestCase
1919
{
2020
/** @var CanViewNotification */
2121
private $canViewNotification;
2222

23-
/** @var Logger|\PHPUnit_Framework_MockObject_MockObject */
23+
/** @var Logger|\PHPUnit\Framework\MockObject\MockObject */
2424
private $viewerLoggerMock;
2525

26-
/** @var ProductMetadataInterface|\PHPUnit_Framework_MockObject_MockObject */
26+
/** @var ProductMetadataInterface|\PHPUnit\Framework\MockObject\MockObject */
2727
private $productMetadataMock;
2828

29-
/** @var Log|\PHPUnit_Framework_MockObject_MockObject */
29+
/** @var Log|\PHPUnit\Framework\MockObject\MockObject */
3030
private $logMock;
3131

32-
/** @var $cacheStorageMock \PHPUnit_Framework_MockObject_MockObject|CacheInterface */
32+
/** @var $cacheStorageMock \PHPUnit\Framework\MockObject\MockObject|CacheInterface */
3333
private $cacheStorageMock;
3434

35-
public function setUp()
35+
protected function setUp(): void
3636
{
3737
$this->cacheStorageMock = $this->getMockBuilder(CacheInterface::class)
3838
->getMockForAbstractClass();
@@ -43,7 +43,7 @@ public function setUp()
4343
->getMock();
4444
$this->productMetadataMock = $this->getMockBuilder(ProductMetadataInterface::class)
4545
->disableOriginalConstructor()
46-
->getMock();
46+
->getMockForAbstractClass();
4747
$objectManager = new ObjectManager($this);
4848
$this->canViewNotification = $objectManager->getObject(
4949
CanViewNotification::class,

app/code/Magento/AdminNotification/Test/Unit/Block/ToolbarEntryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected function _getBlockInstance($unreadNotifications)
2525
\Magento\AdminNotification\Model\ResourceModel\Inbox\Collection\Unread::class,
2626
['getSize', 'setCurPage', 'setPageSize']
2727
);
28-
$notificationList->expects($this->any())->method('getSize')->will($this->returnValue($unreadNotifications));
28+
$notificationList->expects($this->any())->method('getSize')->willReturn($unreadNotifications);
2929

3030
$block = $objectManagerHelper->getObject(
3131
\Magento\AdminNotification\Block\ToolbarEntry::class,
@@ -63,7 +63,7 @@ public function testGetLatestUnreadNotifications()
6363
$notificationList->expects($this->atLeastOnce())
6464
->method('setPageSize')
6565
->with(\Magento\AdminNotification\Block\ToolbarEntry::NOTIFICATIONS_NUMBER)
66-
->will($this->returnSelf());
66+
->willReturnSelf();
6767

6868
// 3. Run tested method
6969
$result = $model->getLatestUnreadNotifications();

app/code/Magento/AdminNotification/Test/Unit/Model/FeedTest.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,37 @@ class FeedTest extends \PHPUnit\Framework\TestCase
2020
/** @var ObjectManagerHelper */
2121
protected $objectManagerHelper;
2222

23-
/** @var \Magento\AdminNotification\Model\InboxFactory|\PHPUnit_Framework_MockObject_MockObject */
23+
/** @var \Magento\AdminNotification\Model\InboxFactory|\PHPUnit\Framework\MockObject\MockObject */
2424
protected $inboxFactory;
2525

26-
/** @var \Magento\AdminNotification\Model\Inbox|\PHPUnit_Framework_MockObject_MockObject */
26+
/** @var \Magento\AdminNotification\Model\Inbox|\PHPUnit\Framework\MockObject\MockObject */
2727
protected $inboxModel;
2828

29-
/** @var \Magento\Framework\HTTP\Adapter\CurlFactory|\PHPUnit_Framework_MockObject_MockObject */
29+
/** @var \Magento\Framework\HTTP\Adapter\CurlFactory|\PHPUnit\Framework\MockObject\MockObject */
3030
protected $curlFactory;
3131

32-
/** @var \Magento\Framework\HTTP\Adapter\Curl|\PHPUnit_Framework_MockObject_MockObject */
32+
/** @var \Magento\Framework\HTTP\Adapter\Curl|\PHPUnit\Framework\MockObject\MockObject */
3333
protected $curl;
3434

35-
/** @var \Magento\Backend\App\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject */
35+
/** @var \Magento\Backend\App\ConfigInterface|\PHPUnit\Framework\MockObject\MockObject */
3636
protected $backendConfig;
3737

38-
/** @var \Magento\Framework\App\CacheInterface|\PHPUnit_Framework_MockObject_MockObject */
38+
/** @var \Magento\Framework\App\CacheInterface|\PHPUnit\Framework\MockObject\MockObject */
3939
protected $cacheManager;
4040

41-
/** @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject */
41+
/** @var \Magento\Framework\App\State|\PHPUnit\Framework\MockObject\MockObject */
4242
protected $appState;
4343

44-
/** @var \Magento\Framework\App\DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject */
44+
/** @var \Magento\Framework\App\DeploymentConfig|\PHPUnit\Framework\MockObject\MockObject */
4545
protected $deploymentConfig;
4646

47-
/** @var \Magento\Framework\App\ProductMetadata|\PHPUnit_Framework_MockObject_MockObject */
47+
/** @var \Magento\Framework\App\ProductMetadata|\PHPUnit\Framework\MockObject\MockObject */
4848
protected $productMetadata;
4949

50-
/** @var \Magento\Framework\UrlInterface|\PHPUnit_Framework_MockObject_MockObject */
50+
/** @var \Magento\Framework\UrlInterface|\PHPUnit\Framework\MockObject\MockObject */
5151
protected $urlBuilder;
5252

53-
protected function setUp()
53+
protected function setUp(): void
5454
{
5555
$this->inboxFactory = $this->createPartialMock(
5656
\Magento\AdminNotification\Model\InboxFactory::class,
@@ -133,19 +133,19 @@ public function testCheckUpdate($callInbox, $curlRequest)
133133

134134
$lastUpdate = 0;
135135
$this->cacheManager->expects($this->once())->method('load')->will(($this->returnValue($lastUpdate)));
136-
$this->curlFactory->expects($this->at(0))->method('create')->will($this->returnValue($this->curl));
136+
$this->curlFactory->expects($this->at(0))->method('create')->willReturn($this->curl);
137137
$this->curl->expects($this->once())->method('setConfig')->with($configValues)->willReturnSelf();
138-
$this->curl->expects($this->once())->method('read')->will($this->returnValue($curlRequest));
139-
$this->backendConfig->expects($this->at(0))->method('getValue')->will($this->returnValue('1'));
140-
$this->backendConfig->expects($this->once())->method('isSetFlag')->will($this->returnValue(false));
138+
$this->curl->expects($this->once())->method('read')->willReturn($curlRequest);
139+
$this->backendConfig->expects($this->at(0))->method('getValue')->willReturn('1');
140+
$this->backendConfig->expects($this->once())->method('isSetFlag')->willReturn(false);
141141
$this->backendConfig->expects($this->at(1))->method('getValue')
142-
->will($this->returnValue('http://feed.magento.com'));
142+
->willReturn('http://feed.magento.com');
143143
$this->deploymentConfig->expects($this->once())->method('get')
144144
->with(ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE)
145-
->will($this->returnValue('Sat, 6 Sep 2014 16:46:11 UTC'));
145+
->willReturn('Sat, 6 Sep 2014 16:46:11 UTC');
146146
if ($callInbox) {
147147
$this->inboxFactory->expects($this->once())->method('create')
148-
->will($this->returnValue($this->inboxModel));
148+
->willReturn($this->inboxModel);
149149
$this->inboxModel->expects($this->once())
150150
->method('parse')
151151
->with(
@@ -165,7 +165,7 @@ function ($initialValue, $item) use ($data) {
165165
}
166166
)
167167
)
168-
->will($this->returnSelf());
168+
->willReturnSelf();
169169
} else {
170170
$this->inboxFactory->expects($this->never())->method('create');
171171
$this->inboxModel->expects($this->never())->method('parse');

app/code/Magento/AdminNotification/Test/Unit/Model/NotificationServiceTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ protected function _getServiceInstanceForMarkAsReadTest($notificationId)
2121
{
2222
/**
2323
* @var
24-
* $notificationFactory \PHPUnit_Framework_MockObject_MockObject|\Magento\AdminNotification\Model\InboxFactory
24+
* $notificationFactory \PHPUnit\Framework\MockObject\MockObject|\Magento\AdminNotification\Model\InboxFactory
2525
*/
2626
$notificationFactory = $this->createPartialMock(
2727
\Magento\AdminNotification\Model\InboxFactory::class,
@@ -31,16 +31,16 @@ protected function _getServiceInstanceForMarkAsReadTest($notificationId)
3131
\Magento\AdminNotification\Model\Inbox::class,
3232
['load', 'getId', 'save', 'setIsRead', '__sleep', '__wakeup']
3333
);
34-
$notification->expects($this->once())->method('load')->with($notificationId)->will($this->returnSelf());
35-
$notification->expects($this->once())->method('getId')->will($this->returnValue($notificationId));
34+
$notification->expects($this->once())->method('load')->with($notificationId)->willReturnSelf();
35+
$notification->expects($this->once())->method('getId')->willReturn($notificationId);
3636

3737
// when notification Id is valid, add additional expectations
3838
if ($notificationId) {
39-
$notification->expects($this->once())->method('save')->will($this->returnSelf());
40-
$notification->expects($this->once())->method('setIsRead')->with(1)->will($this->returnSelf());
39+
$notification->expects($this->once())->method('save')->willReturnSelf();
40+
$notification->expects($this->once())->method('setIsRead')->with(1)->willReturnSelf();
4141
}
4242

43-
$notificationFactory->expects($this->once())->method('create')->will($this->returnValue($notification));
43+
$notificationFactory->expects($this->once())->method('create')->willReturn($notification);
4444
return new \Magento\AdminNotification\Model\NotificationService($notificationFactory);
4545
}
4646

@@ -52,11 +52,12 @@ public function testMarkAsRead()
5252
}
5353

5454
/**
55-
* @expectedException \Magento\Framework\Exception\LocalizedException
56-
* @expectedExceptionMessage Wrong notification ID specified.
5755
*/
5856
public function testMarkAsReadThrowsExceptionWhenNotificationIdIsInvalid()
5957
{
58+
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
59+
$this->expectExceptionMessage('Wrong notification ID specified.');
60+
6061
$notificationId = null;
6162
$service = $this->_getServiceInstanceForMarkAsReadTest($notificationId);
6263
$service->markAsRead($notificationId);

app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/CacheOutdatedTest.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
class CacheOutdatedTest extends \PHPUnit\Framework\TestCase
99
{
1010
/**
11-
* @var \PHPUnit_Framework_MockObject_MockObject
11+
* @var \PHPUnit\Framework\MockObject\MockObject
1212
*/
1313
protected $_authorizationMock;
1414

1515
/**
16-
* @var \PHPUnit_Framework_MockObject_MockObject
16+
* @var \PHPUnit\Framework\MockObject\MockObject
1717
*/
1818
protected $_cacheTypeListMock;
1919

2020
/**
21-
* @var \PHPUnit_Framework_MockObject_MockObject
21+
* @var \PHPUnit\Framework\MockObject\MockObject
2222
*/
2323
protected $_urlInterfaceMock;
2424

@@ -27,7 +27,7 @@ class CacheOutdatedTest extends \PHPUnit\Framework\TestCase
2727
*/
2828
protected $_messageModel;
2929

30-
protected function setUp()
30+
protected function setUp(): void
3131
{
3232
$this->_authorizationMock = $this->createMock(\Magento\Framework\AuthorizationInterface::class);
3333
$this->_urlInterfaceMock = $this->createMock(\Magento\Framework\UrlInterface::class);
@@ -56,8 +56,8 @@ public function testGetIdentity($expectedSum, $cacheTypes)
5656
$this->any()
5757
)->method(
5858
'getInvalidated'
59-
)->will(
60-
$this->returnValue($cacheTypes)
59+
)->willReturn(
60+
$cacheTypes
6161
);
6262
$this->assertEquals($expectedSum, $this->_messageModel->getIdentity());
6363
}
@@ -68,10 +68,10 @@ public function testGetIdentity($expectedSum, $cacheTypes)
6868
public function getIdentityDataProvider()
6969
{
7070
$cacheTypeMock1 = $this->createPartialMock(\stdClass::class, ['getCacheType']);
71-
$cacheTypeMock1->expects($this->any())->method('getCacheType')->will($this->returnValue('Simple'));
71+
$cacheTypeMock1->expects($this->any())->method('getCacheType')->willReturn('Simple');
7272

7373
$cacheTypeMock2 = $this->createPartialMock(\stdClass::class, ['getCacheType']);
74-
$cacheTypeMock2->expects($this->any())->method('getCacheType')->will($this->returnValue('Advanced'));
74+
$cacheTypeMock2->expects($this->any())->method('getCacheType')->willReturn('Advanced');
7575

7676
return [
7777
['c13cfaddc2c53e8d32f59bfe89719beb', [$cacheTypeMock1]],
@@ -87,13 +87,13 @@ public function getIdentityDataProvider()
8787
*/
8888
public function testIsDisplayed($expected, $allowed, $cacheTypes)
8989
{
90-
$this->_authorizationMock->expects($this->once())->method('isAllowed')->will($this->returnValue($allowed));
90+
$this->_authorizationMock->expects($this->once())->method('isAllowed')->willReturn($allowed);
9191
$this->_cacheTypeListMock->expects(
9292
$this->any()
9393
)->method(
9494
'getInvalidated'
95-
)->will(
96-
$this->returnValue($cacheTypes)
95+
)->willReturn(
96+
$cacheTypes
9797
);
9898
$this->assertEquals($expected, $this->_messageModel->isDisplayed());
9999
}
@@ -104,7 +104,7 @@ public function testIsDisplayed($expected, $allowed, $cacheTypes)
104104
public function isDisplayedDataProvider()
105105
{
106106
$cacheTypesMock = $this->createPartialMock(\stdClass::class, ['getCacheType']);
107-
$cacheTypesMock->expects($this->any())->method('getCacheType')->will($this->returnValue('someVal'));
107+
$cacheTypesMock->expects($this->any())->method('getCacheType')->willReturn('someVal');
108108
$cacheTypes = [$cacheTypesMock, $cacheTypesMock];
109109
return [
110110
[false, false, []],
@@ -118,15 +118,15 @@ public function testGetText()
118118
{
119119
$messageText = 'One or more of the Cache Types are invalidated';
120120

121-
$this->_cacheTypeListMock->expects($this->any())->method('getInvalidated')->will($this->returnValue([]));
122-
$this->_urlInterfaceMock->expects($this->once())->method('getUrl')->will($this->returnValue('someURL'));
123-
$this->assertContains($messageText, $this->_messageModel->getText());
121+
$this->_cacheTypeListMock->expects($this->any())->method('getInvalidated')->willReturn([]);
122+
$this->_urlInterfaceMock->expects($this->once())->method('getUrl')->willReturn('someURL');
123+
$this->assertStringContainsString($messageText, $this->_messageModel->getText());
124124
}
125125

126126
public function testGetLink()
127127
{
128128
$url = 'backend/admin/cache';
129-
$this->_urlInterfaceMock->expects($this->once())->method('getUrl')->will($this->returnValue($url));
129+
$this->_urlInterfaceMock->expects($this->once())->method('getUrl')->willReturn($url);
130130
$this->assertEquals($url, $this->_messageModel->getLink());
131131
}
132132
}

app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/Media/Synchronization/ErrorTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
class ErrorTest extends \PHPUnit\Framework\TestCase
99
{
1010
/**
11-
* @var \PHPUnit_Framework_MockObject_MockObject
11+
* @var \PHPUnit\Framework\MockObject\MockObject
1212
*/
1313
protected $_syncFlagMock;
1414

1515
/**
16-
* @var \PHPUnit_Framework_MockObject_MockObject
16+
* @var \PHPUnit\Framework\MockObject\MockObject
1717
*/
1818
protected $_fileStorage;
1919

@@ -22,15 +22,15 @@ class ErrorTest extends \PHPUnit\Framework\TestCase
2222
*/
2323
protected $_model;
2424

25-
protected function setUp()
25+
protected function setUp(): void
2626
{
2727
$this->_syncFlagMock = $this->createPartialMock(
2828
\Magento\MediaStorage\Model\File\Storage\Flag::class,
2929
['setState', 'save', 'getFlagData']
3030
);
3131

3232
$this->_fileStorage = $this->createMock(\Magento\MediaStorage\Model\File\Storage\Flag::class);
33-
$this->_fileStorage->expects($this->any())->method('loadSelf')->will($this->returnValue($this->_syncFlagMock));
33+
$this->_fileStorage->expects($this->any())->method('loadSelf')->willReturn($this->_syncFlagMock);
3434

3535
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
3636
$arguments = ['fileStorage' => $this->_fileStorage];
@@ -44,7 +44,7 @@ public function testGetText()
4444
{
4545
$messageText = 'We were unable to synchronize one or more media files.';
4646

47-
$this->assertContains($messageText, (string)$this->_model->getText());
47+
$this->assertStringContainsString($messageText, (string)$this->_model->getText());
4848
}
4949

5050
/**
@@ -65,7 +65,7 @@ public function testIsDisplayed($expectedFirstRun, $data)
6565

6666
$this->_syncFlagMock->expects($this->any())->method('setState');
6767
$this->_syncFlagMock->expects($this->any())->method('save');
68-
$this->_syncFlagMock->expects($this->any())->method('getFlagData')->will($this->returnValue($data));
68+
$this->_syncFlagMock->expects($this->any())->method('getFlagData')->willReturn($data);
6969
//check first call
7070
$this->assertEquals($expectedFirstRun, $model->isDisplayed());
7171
//check second call(another branch of if operator)

app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/SecurityTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@
88
class SecurityTest extends \PHPUnit\Framework\TestCase
99
{
1010
/**
11-
* @var \PHPUnit_Framework_MockObject_MockObject
11+
* @var \PHPUnit\Framework\MockObject\MockObject
1212
*/
1313
protected $_cacheMock;
1414

1515
/**
16-
* @var \PHPUnit_Framework_MockObject_MockObject
16+
* @var \PHPUnit\Framework\MockObject\MockObject
1717
*/
1818
protected $_scopeConfigMock;
1919

2020
/**
21-
* @var \PHPUnit_Framework_MockObject_MockObject
21+
* @var \PHPUnit\Framework\MockObject\MockObject
2222
*/
2323
protected $_configMock;
2424

2525
/**
26-
* @var \PHPUnit_Framework_MockObject_MockObject
26+
* @var \PHPUnit\Framework\MockObject\MockObject
2727
*/
2828
protected $_curlFactoryMock;
2929

@@ -32,7 +32,7 @@ class SecurityTest extends \PHPUnit\Framework\TestCase
3232
*/
3333
protected $_messageModel;
3434

35-
protected function setUp()
35+
protected function setUp(): void
3636
{
3737
//Prepare objects for constructor
3838
$this->_cacheMock = $this->createMock(\Magento\Framework\App\CacheInterface::class);
@@ -64,14 +64,14 @@ protected function setUp()
6464
*/
6565
public function testIsDisplayed($expectedResult, $cached, $response)
6666
{
67-
$this->_cacheMock->expects($this->any())->method('load')->will($this->returnValue($cached));
68-
$this->_cacheMock->expects($this->any())->method('save')->will($this->returnValue(null));
67+
$this->_cacheMock->expects($this->any())->method('load')->willReturn($cached);
68+
$this->_cacheMock->expects($this->any())->method('save')->willReturn(null);
6969

7070
$httpAdapterMock = $this->createMock(\Magento\Framework\HTTP\Adapter\Curl::class);
71-
$httpAdapterMock->expects($this->any())->method('read')->will($this->returnValue($response));
72-
$this->_curlFactoryMock->expects($this->any())->method('create')->will($this->returnValue($httpAdapterMock));
71+
$httpAdapterMock->expects($this->any())->method('read')->willReturn($response);
72+
$this->_curlFactoryMock->expects($this->any())->method('create')->willReturn($httpAdapterMock);
7373

74-
$this->_scopeConfigMock->expects($this->any())->method('getValue')->will($this->returnValue(null));
74+
$this->_scopeConfigMock->expects($this->any())->method('getValue')->willReturn(null);
7575

7676
$this->assertEquals($expectedResult, $this->_messageModel->isDisplayed());
7777
}

0 commit comments

Comments
 (0)