Skip to content

Commit 9e18727

Browse files
committed
Merge branch '2.3-develop-php74' of https://github.com/magento-commerce/magento2ce into MC-40559
2 parents b0646de + 268b776 commit 9e18727

File tree

42 files changed

+359
-164
lines changed

Some content is hidden

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

42 files changed

+359
-164
lines changed

app/code/Magento/AsynchronousOperations/Test/Unit/Model/ResourceModel/System/Message/Collection/Synchronized/PluginTest.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,19 @@ public function testAfterTo($operationDetails)
159159
public function afterToDataProvider()
160160
{
161161
return [
162-
['operations_successful' => 0,
163-
'operations_failed' => 0,
164-
'operations_total' => 10
162+
[
163+
[
164+
'operations_successful' => 0,
165+
'operations_failed' => 0,
166+
'operations_total' => 10
167+
]
165168
],
166-
['operations_successful' => 1,
167-
'operations_failed' => 2,
168-
'operations_total' => 10
169+
[
170+
[
171+
'operations_successful' => 1,
172+
'operations_failed' => 2,
173+
'operations_total' => 10
174+
]
169175
],
170176
];
171177
}

app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/BundleTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace Magento\BundleImportExport\Test\Unit\Model\Import\Product\Type;
88

99
/**
10-
* Class BundleTest
10+
* Tests for Bundle
1111
*
1212
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
1313
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -223,6 +223,7 @@ public function testSaveData($skus, $bunch, $allowImport)
223223
);
224224
$scope = $this->getMockBuilder(\Magento\Framework\App\ScopeInterface::class)->getMockForAbstractClass();
225225
$this->scopeResolver->expects($this->any())->method('getScope')->willReturn($scope);
226+
$this->connection->method('fetchPairs')->willReturn([1 => 'sku']);
226227
$this->connection->expects($this->any())->method('fetchAssoc')->with($this->select)->willReturn([
227228
'1' => [
228229
'option_id' => '1',

app/code/Magento/Catalog/Model/Product/TierPriceManagement.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ public function __construct(
9090
*/
9191
public function add($sku, $customerGroupId, $price, $qty)
9292
{
93-
if (!\Zend_Validate::is($price, 'Float') || $price <= 0 || !\Zend_Validate::is($qty, 'Float') || $qty <= 0) {
93+
if (!\Zend_Validate::is((string)$price, 'Float')
94+
|| $price <= 0 || !\Zend_Validate::is((string)$qty, 'Float')
95+
|| $qty <= 0
96+
) {
9497
throw new InputException(__('The data was invalid. Verify the data and try again.'));
9598
}
9699
$product = $this->productRepository->get($sku, ['edit_mode' => true]);

app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Helper/Form/Gallery/ContentTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,9 @@ public function testGetImagesJsonMediaStorageMode()
429429
$this->readMock->expects($this->any())
430430
->method('isFile')
431431
->willReturn(false);
432+
$this->readMock->expects($this->any())
433+
->method('stat')
434+
->willReturn(['size' => 0]);
432435
$this->databaseMock->expects($this->any())
433436
->method('checkDbUsage')
434437
->willReturn(true);

app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ public function testDeleteWithInvalidDataException()
251251
public function testDeleteWithNoSuchEntityException()
252252
{
253253
$this->expectException(\Magento\Framework\Exception\NoSuchEntityException::class);
254-
$this->expectExceptionMessage('Product with SKU \'linkedProduct\' is not linked to product with SKU \'product\'');
254+
$this->expectExceptionMessage(
255+
'Product with SKU \'linkedProduct\' is not linked to product with SKU \'product\''
256+
);
255257

256258
$entityMock = $this->createMock(\Magento\Catalog\Model\ProductLink\Link::class);
257259
$productMock = $this->createMock(\Magento\Catalog\Model\Product::class);
@@ -266,6 +268,11 @@ public function testDeleteWithNoSuchEntityException()
266268
$entityMock->expects($this->exactly(2))->method('getSku')->willReturn('product');
267269
$entityMock->expects($this->once())->method('getLinkType')->willReturn('linkType');
268270
$this->metadataPoolMock->expects($this->once())->method('getHydrator')->willReturn($this->hydratorMock);
271+
272+
$this->metadataMock->expects($this->once())->method('getLinkField')->willReturn('linkField');
273+
$this->hydratorMock->expects($this->once())->method('extract')->willReturn(['linkField' => 'parent_id']);
274+
$this->linkTypeProvider->expects($this->once())->method('getLinkTypes')->willReturn(['linkType' => 1]);
275+
269276
$this->model->delete($entityMock);
270277
}
271278
}

app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/CategoryTest.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
*/
2828
class CategoryTest extends \PHPUnit\Framework\TestCase
2929
{
30+
private const STUB_PRIMARY_KEY = 'PK';
31+
3032
/**
3133
* @var Category
3234
*/
@@ -161,11 +163,19 @@ public function testFindWhereAttributeIs()
161163
$this->serializerMock->expects($this->once())
162164
->method('serialize')
163165
->willReturnCallback(
164-
165-
function ($value) {
166-
return json_encode($value);
167-
}
168-
166+
function ($value) {
167+
return json_encode($value);
168+
}
169+
);
170+
171+
$this->connectionMock->method('getPrimaryKeyName')->willReturn(self::STUB_PRIMARY_KEY);
172+
$this->connectionMock->method('getIndexList')
173+
->willReturn(
174+
[
175+
self::STUB_PRIMARY_KEY => [
176+
'COLUMNS_LIST' => ['Column']
177+
]
178+
]
169179
);
170180

171181
$result = $this->category->findWhereAttributeIs($entityIdsFilter, $attribute, $expectedValue);

app/code/Magento/Checkout/Model/Sidebar.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
use Magento\Quote\Model\Quote\Address\Total;
1414

1515
/**
16+
* Data model for the sidebar
17+
*
1618
* @deprecated 100.1.0
1719
*/
1820
class Sidebar
@@ -130,7 +132,7 @@ protected function normalize($itemQty)
130132
$filter = new \Zend_Filter_LocalizedToNormalized(
131133
['locale' => $this->resolver->getLocale()]
132134
);
133-
return $filter->filter($itemQty);
135+
return $filter->filter((string)$itemQty);
134136
}
135137
return $itemQty;
136138
}

app/code/Magento/Config/Test/Unit/Model/Config/Backend/Email/LogoTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ public function testBeforeSaveWithTmpInValue()
159159
->with(Logo::UPLOAD_DIR . '/' . $oldValue)
160160
->willReturn(true);
161161

162+
$this->uploaderMock->method('save')
163+
->willReturn(['file' => $oldValue]);
164+
162165
$this->assertEquals($this->model, $this->model->beforeSave());
163166
}
164167

app/code/Magento/Config/Test/Unit/Model/Config/Backend/Image/LogoTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ public function testBeforeSave()
7474
$this->uploaderMock->expects($this->once())
7575
->method('setAllowedExtensions')
7676
->with($this->equalTo(['jpg', 'jpeg', 'gif', 'png']));
77+
78+
$this->uploaderMock->method('save')
79+
->willReturn(['file' => 'filename']);
80+
7781
$this->model->beforeSave();
7882
}
7983
}

app/code/Magento/Customer/Test/Unit/Model/ResourceModel/AddressTest.php

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Magento\Customer\Test\Unit\Model\ResourceModel;
88

9+
use Magento\Customer\Model\Address;
910
use Magento\Framework\Model\ResourceModel\Db\VersionControl\RelationComposite;
1011
use Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot;
1112
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
@@ -63,21 +64,22 @@ protected function setUp(): void
6364
public function testSave($addressId, $isDefaultBilling, $isDefaultShipping)
6465
{
6566
/** @var $address \Magento\Customer\Model\Address|\PHPUnit\Framework\MockObject\MockObject */
66-
$address = $this->createPartialMock(
67-
\Magento\Customer\Model\Address::class,
68-
[
69-
'__wakeup',
70-
'getId',
71-
'getEntityTypeId',
72-
'getIsDefaultBilling',
73-
'getIsDefaultShipping',
74-
'hasDataChanges',
75-
'validateBeforeSave',
76-
'beforeSave',
77-
'afterSave',
78-
'isSaveAllowed'
79-
]
80-
);
67+
$address = $this->getMockBuilder(Address::class)
68+
->addMethods(['getIsDefaultBilling', 'getIsDefaultShipping'])
69+
->onlyMethods(
70+
[
71+
'__wakeup',
72+
'getId',
73+
'getEntityTypeId',
74+
'hasDataChanges',
75+
'validateBeforeSave',
76+
'beforeSave',
77+
'afterSave',
78+
'isSaveAllowed'
79+
]
80+
)
81+
->disableOriginalConstructor()
82+
->getMock();
8183
$this->entitySnapshotMock->expects($this->once())->method('isModified')->willReturn(true);
8284
$this->entityRelationCompositeMock->expects($this->once())->method('processRelations');
8385
$address->expects($this->once())->method('isSaveAllowed')->willReturn(true);
@@ -260,7 +262,6 @@ public function testGetType()
260262
/**
261263
* Class SubResourceModelAddress
262264
* Mock method getAttributeLoader
263-
* @package Magento\Customer\Test\Unit\Model\ResourceModel
264265
* @codingStandardsIgnoreStart
265266
*/
266267
class SubResourceModelAddress extends \Magento\Customer\Model\ResourceModel\Address

0 commit comments

Comments
 (0)