Skip to content

Commit ca1baad

Browse files
authored
Merge branch '2.4-develop' into magento-coding-standard-update
2 parents 3c08d12 + da881af commit ca1baad

File tree

52 files changed

+1517
-1182
lines changed

Some content is hidden

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

52 files changed

+1517
-1182
lines changed

Gruntfile.js.sample

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ module.exports = function (grunt) {
1616
tasks = grunt.file.expand('./dev/tools/grunt/tasks/*'),
1717
themes;
1818

19-
filesRouter.set('themes', 'dev/tools/grunt/configs/themes');
20-
themes = filesRouter.get('themes');
19+
filesRouter.set('themes', 'dev/tools/grunt/configs/themes');
20+
themes = filesRouter.get('themes');
2121

22-
tasks = _.map(tasks, function(task){ return task.replace('.js', '') });
22+
tasks = _.map(tasks, function (task) {
23+
return task.replace('.js', '');
24+
});
2325
tasks.push('time-grunt');
2426
tasks.forEach(function (task) {
2527
require(task)(grunt);
@@ -53,7 +55,7 @@ module.exports = function (grunt) {
5355
'autoprefixer',
5456
'cssmin',
5557
'usebanner'
56-
].map(function(task){
58+
].map(function (task) {
5759
return task + ':' + component;
5860
});
5961

@@ -72,7 +74,7 @@ module.exports = function (grunt) {
7274
'clean',
7375
'exec:all'
7476
];
75-
_.each(themes, function(theme, name) {
77+
_.each(themes, function (theme, name) {
7678
tasks.push('less:' + name);
7779
});
7880
grunt.task.run(tasks);

app/code/Magento/Analytics/Test/Unit/Model/Connector/Http/Client/CurlTest.php

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ class CurlTest extends TestCase
5050
private $converterMock;
5151

5252
/**
53-
* @return void
53+
* @inheritdoc
5454
*/
5555
protected function setUp(): void
5656
{
5757
$this->curlAdapterMock = $this->createMock(\Magento\Framework\HTTP\Adapter\Curl::class);
5858

5959
$this->loggerMock = $this->getMockForAbstractClass(LoggerInterface::class);
6060
$curlFactoryMock = $this->getMockBuilder(CurlFactory::class)
61-
->setMethods(['create'])
61+
->onlyMethods(['create'])
6262
->disableOriginalConstructor()
6363
->getMock();
6464
$curlFactoryMock
@@ -76,7 +76,7 @@ protected function setUp(): void
7676
'curlFactory' => $curlFactoryMock,
7777
'responseFactory' => $this->responseFactoryMock,
7878
'converter' => $this->converterMock,
79-
'logger' => $this->loggerMock,
79+
'logger' => $this->loggerMock
8080
]
8181
);
8282
}
@@ -94,7 +94,7 @@ public function getTestData()
9494
'version' => '1.1',
9595
'body'=> ['name' => 'value'],
9696
'url' => 'http://www.mystore.com',
97-
'method' => ZendClient::POST,
97+
'method' => ZendClient::POST
9898
]
9999
]
100100
];
@@ -122,14 +122,8 @@ public function testRequestSuccess(array $data)
122122
$this->curlAdapterMock->expects($this->once())
123123
->method('read')
124124
->willReturn($responseString);
125-
$this->curlAdapterMock
126-
->method('getErrno')
127-
->willReturn(0);
128-
129-
$this->responseFactoryMock
130-
->method('create')
131-
->with($responseString)
132-
->willReturn($response);
125+
$this->curlAdapterMock->method('getErrno')->willReturn(0);
126+
$this->responseFactoryMock->method('create')->with($responseString)->willReturn($response);
133127

134128
$this->assertEquals(
135129
$response,
@@ -196,7 +190,7 @@ public function testRequestError(array $data)
196190
private function createJsonConverter()
197191
{
198192
$converterMock = $this->getMockBuilder(JsonConverter::class)
199-
->setMethodsExcept(['getContentTypeHeader'])
193+
->onlyMethods(['getContentTypeHeader','toBody'])
200194
->disableOriginalConstructor()
201195
->getMock();
202196
$converterMock->method('toBody')->willReturnCallback(function ($value) {

app/code/Magento/AwsS3/Driver/AwsS3.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ public function fileClose($resource): bool
851851
//phpcs:enable
852852

853853
foreach ($this->streams as $path => $stream) {
854-
//phpcs:disable
854+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
855855
if (stream_get_meta_data($stream)['uri'] === $resourcePath) {
856856
$this->adapter->writeStream($path, $resource, new Config(self::CONFIG));
857857

app/code/Magento/Backup/Test/Unit/Model/Fs/CollectionTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717

1818
class CollectionTest extends TestCase
1919
{
20-
public function testConstructor()
20+
/**
21+
* @return void
22+
*/
23+
public function testConstructor(): void
2124
{
2225
$helper = new ObjectManager($this);
2326
$filesystem = $this->getMockBuilder(Filesystem::class)
@@ -39,8 +42,9 @@ public function testConstructor()
3942
)->disableOriginalConstructor()
4043
->getMock();
4144
$directoryWrite->expects($this->any())->method('create')->with('backups');
42-
$directoryWrite->expects($this->any())->method('getAbsolutePath')->willReturn('');
43-
$directoryWrite->expects($this->at(3))->method('getAbsolutePath')->with('backups');
45+
$directoryWrite->method('getAbsolutePath')
46+
->withConsecutive([], [], ['backups'])
47+
->willReturnOnConsecutiveCalls('', '');
4448
$directoryWrite->expects($this->any())->method('isDirectory')->willReturn(true);
4549
$directoryWrite->expects($this->any())->method('getDriver')->willReturn($driver);
4650
$targetDirectory = $this->getMockBuilder(TargetDirectory::class)

app/code/Magento/Catalog/Model/Product/ProductFrontendAction/Synchronizer.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,9 @@ private function filterNewestActions(array $productsData, $typeId)
133133
$productsData,
134134
function (array $firstProduct, array $secondProduct) {
135135
if (isset($firstProduct['added_at'], $secondProduct['added_at'])) {
136-
return $firstProduct['added_at'] > $secondProduct['added_at'];
136+
return ($firstProduct['added_at'] <=> $secondProduct['added_at']);
137137
}
138-
139-
return false;
138+
return 0;
140139
}
141140
);
142141

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Category/SaveTest.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ class SaveTest extends TestCase
8282
private $save;
8383

8484
/**
85-
* Set up
85+
* Set up.
8686
*
87-
* @return void
87+
* @inheritdoc
8888
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
8989
*/
9090
protected function setUp(): void
@@ -144,17 +144,17 @@ protected function setUp(): void
144144
}
145145

146146
/**
147-
* Run test execute method
147+
* Run test execute method.
148148
*
149149
* @param int|bool $categoryId
150150
* @param int $storeId
151151
* @param int|null $parentId
152-
* @return void
153152
*
153+
* @return void
154154
* @dataProvider dataProviderExecute
155155
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
156156
*/
157-
public function testExecute($categoryId, $storeId, $parentId)
157+
public function testExecute($categoryId, $storeId, $parentId): void
158158
{
159159
$this->markTestSkipped('Due to MAGETWO-48956');
160160

@@ -407,9 +407,7 @@ public function testExecute($categoryId, $storeId, $parentId)
407407
$this->messageManagerMock->expects($this->once())
408408
->method('addSuccessMessage')
409409
->with(__('You saved the category.'));
410-
$categoryMock->expects($this->at(1))
411-
->method('getId')
412-
->willReturn(111);
410+
$categoryMock->method('getId')->willReturn(111);
413411
$this->layoutFactoryMock->expects($this->once())
414412
->method('create')
415413
->willReturn($layoutMock);
@@ -449,30 +447,30 @@ public function testExecute($categoryId, $storeId, $parentId)
449447
}
450448

451449
/**
452-
* Data provider for execute
450+
* Data provider for execute.
453451
*
454452
* @return array
455453
*/
456-
public function dataProviderExecute()
454+
public function dataProviderExecute(): array
457455
{
458456
return [
459457
[
460458
'categoryId' => false,
461459
'storeId' => 7,
462-
'parentId' => 123,
460+
'parentId' => 123
463461
],
464462
[
465463
'categoryId' => false,
466464
'storeId' => 7,
467-
'parentId' => null,
465+
'parentId' => null
468466
]
469467
];
470468
}
471469

472470
/**
473471
* @return array
474472
*/
475-
public function imagePreprocessingDataProvider()
473+
public function imagePreprocessingDataProvider(): array
476474
{
477475
$dataWithImage = [
478476
'image' => 'path.jpg',
@@ -502,7 +500,7 @@ public function imagePreprocessingDataProvider()
502500
* @param array $data
503501
* @param array $expected
504502
*/
505-
public function testImagePreprocessing($data, $expected)
503+
public function testImagePreprocessing($data, $expected): void
506504
{
507505
$eavConfig = $this->createPartialMock(\Magento\Eav\Model\Config::class, ['getEntityType']);
508506

0 commit comments

Comments
 (0)