Skip to content

Commit 9ead590

Browse files
committed
MC-34039: Merge 2.4-develop into 2.4-develop-php74
1 parent 1b6184e commit 9ead590

File tree

14 files changed

+33
-29
lines changed

14 files changed

+33
-29
lines changed

app/code/Magento/Cron/Test/Unit/Model/DeadlockRetrierTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,19 @@ class DeadlockRetrierTest extends \PHPUnit\Framework\TestCase
3535
/**
3636
* @inheritdoc
3737
*/
38-
protected function setUp()
38+
protected function setUp(): void
3939
{
40-
$this->adapterMock = $this->createMock(AdapterInterface::class);
40+
$this->adapterMock = $this->getMockForAbstractClass(AdapterInterface::class);
4141
$this->modelMock = $this->createMock(AbstractModel::class);
4242
$this->retrier = new DeadlockRetrier();
4343
}
4444

4545
/**
46-
* @expectedException \Magento\Framework\DB\Adapter\DeadlockException
4746
*/
4847
public function testInsideTransaction(): void
4948
{
49+
$this->expectException(\Magento\Framework\DB\Adapter\DeadlockException::class);
50+
5051
$this->adapterMock->expects($this->once())
5152
->method('getTransactionLevel')
5253
->willReturn(1);
@@ -63,10 +64,11 @@ function () {
6364
}
6465

6566
/**
66-
* @expectedException \Magento\Framework\DB\Adapter\DeadlockException
6767
*/
6868
public function testRetry(): void
6969
{
70+
$this->expectException(\Magento\Framework\DB\Adapter\DeadlockException::class);
71+
7072
$this->adapterMock->expects($this->once())
7173
->method('getTransactionLevel')
7274
->willReturn(0);

app/code/Magento/Cron/Test/Unit/Model/ScheduleTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ protected function setUp(): void
8181
->setMethods(['create'])
8282
->getMock();
8383

84-
$this->retrierMock = $this->createMock(DeadlockRetrierInterface::class);
84+
$this->retrierMock = $this->getMockForAbstractClass(DeadlockRetrierInterface::class);
8585
}
8686

8787
/**
@@ -477,7 +477,7 @@ public function testTryLockJobSuccess(): void
477477
$jobCode = 'test_job';
478478
$tableName = 'cron_schedule';
479479

480-
$connectionMock = $this->createMock(AdapterInterface::class);
480+
$connectionMock = $this->getMockForAbstractClass(AdapterInterface::class);
481481
$connectionMock->expects($this->once())
482482
->method('update')
483483
->with(
@@ -535,7 +535,7 @@ public function testTryLockJobFailure(): void
535535
$jobCode = 'test_job';
536536
$tableName = 'cron_schedule';
537537

538-
$connectionMock = $this->createMock(AdapterInterface::class);
538+
$connectionMock = $this->getMockForAbstractClass(AdapterInterface::class);
539539
$connectionMock->expects($this->once())
540540
->method('update')
541541
->with(

app/code/Magento/Cron/Test/Unit/Observer/ProcessCronQueueObserverTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ protected function setUp(): void
223223
->getMock();
224224
$this->statFactory->expects($this->any())->method('create')->willReturn($this->stat);
225225

226-
$this->retrierMock = $this->createMock(DeadlockRetrierInterface::class);
226+
$this->retrierMock = $this->getMockForAbstractClass(DeadlockRetrierInterface::class);
227227

228228
$this->cronQueueObserver = new ProcessCronQueueObserver(
229229
$this->objectManagerMock,
@@ -313,7 +313,7 @@ public function testDispatchCanNotLock()
313313
$schedule->expects($this->never())->method('setFinishedAt');
314314
$schedule->expects($this->once())->method('getResource')->willReturn($this->scheduleResourceMock);
315315

316-
$connectionMock = $this->createMock(AdapterInterface::class);
316+
$connectionMock = $this->getMockForAbstractClass(AdapterInterface::class);
317317

318318
$this->scheduleResourceMock->expects($this->once())
319319
->method('getConnection')
@@ -398,7 +398,7 @@ public function testDispatchExceptionTooLate()
398398
$schedule->expects($this->once())->method('save');
399399
$schedule->expects($this->once())->method('getResource')->willReturn($this->scheduleResourceMock);
400400

401-
$connectionMock = $this->createMock(AdapterInterface::class);
401+
$connectionMock = $this->getMockForAbstractClass(AdapterInterface::class);
402402

403403
$this->scheduleResourceMock->expects($this->once())
404404
->method('getConnection')
@@ -482,7 +482,7 @@ public function testDispatchExceptionNoCallback()
482482
$schedule->expects($this->any())->method('getStatus')->willReturn(Schedule::STATUS_ERROR);
483483
$schedule->expects($this->once())->method('save');
484484
$schedule->expects($this->once())->method('getResource')->willReturn($this->scheduleResourceMock);
485-
$connectionMock = $this->createMock(AdapterInterface::class);
485+
$connectionMock = $this->getMockForAbstractClass(AdapterInterface::class);
486486

487487
$this->scheduleResourceMock->expects($this->once())
488488
->method('getConnection')
@@ -593,7 +593,7 @@ public function testDispatchExceptionInCallback(
593593
$schedule->expects($this->exactly($saveCalls))->method('save');
594594
$schedule->expects($this->exactly($saveCalls))->method('getResource')->willReturn($this->scheduleResourceMock);
595595

596-
$connectionMock = $this->createMock(AdapterInterface::class);
596+
$connectionMock = $this->getMockForAbstractClass(AdapterInterface::class);
597597

598598
$this->scheduleResourceMock->expects($this->exactly($saveCalls))
599599
->method('getConnection')
@@ -717,7 +717,7 @@ public function testDispatchRunJob()
717717
$schedule->expects($this->any())->method('setFinishedAt')->willReturnSelf();
718718
$schedule->expects($this->exactly(2))->method('getResource')->willReturn($this->scheduleResourceMock);
719719

720-
$connectionMock = $this->createMock(AdapterInterface::class);
720+
$connectionMock = $this->getMockForAbstractClass(AdapterInterface::class);
721721

722722
$this->scheduleResourceMock->expects($this->exactly(2))
723723
->method('getConnection')
@@ -1050,7 +1050,7 @@ public function testMissedJobsCleanedInTime()
10501050
$scheduleMock->expects($this->exactly(9))->method('getResource')->willReturn($this->scheduleResourceMock);
10511051
$this->scheduleFactoryMock->expects($this->exactly(10))->method('create')->willReturn($scheduleMock);
10521052

1053-
$connectionMock = $this->createMock(AdapterInterface::class);
1053+
$connectionMock = $this->getMockForAbstractClass(AdapterInterface::class);
10541054

10551055
$connectionMock->expects($this->exactly(5))
10561056
->method('delete')

app/code/Magento/Elasticsearch/Test/Unit/Setup/InstallConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class InstallConfigTest extends TestCase
2525
*/
2626
private $configWriterMock;
2727

28-
protected function setup()
28+
protected function setup(): void
2929
{
3030
$this->configWriterMock = $this->getMockBuilder(WriterInterface::class)->getMockForAbstractClass();
3131

app/code/Magento/Elasticsearch/Test/Unit/Setup/ValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ValidatorTest extends TestCase
3131
*/
3232
private $elasticsearchClientMock;
3333

34-
protected function setUp()
34+
protected function setUp(): void
3535
{
3636
$this->clientResolverMock = $this->getMockBuilder(ClientResolver::class)
3737
->disableOriginalConstructor()

app/code/Magento/Search/Test/Unit/Model/SearchEngine/ValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ValidatorTest extends TestCase
2424

2525
private $scopeConfigMock;
2626

27-
protected function setUp()
27+
protected function setUp(): void
2828
{
2929
$objectManager = new ObjectManager($this);
3030
$this->otherEngineValidatorMock = $this->getMockForAbstractClass(ValidatorInterface::class);

app/code/Magento/Search/Test/Unit/Setup/CompositeInstallConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class CompositeInstallConfigTest extends TestCase
3636
*/
3737
private $scopeConfigMock;
3838

39-
protected function setup()
39+
protected function setup(): void
4040
{
4141
$objectManager = new ObjectManager($this);
4242
$this->firstInstallConfigMock = $this->getMockForAbstractClass(InstallConfigInterface::class);

dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Action/FullTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
class FullTest extends \PHPUnit\Framework\TestCase
2222
{
23-
protected function setUp()
23+
protected function setUp(): void
2424
{
2525
$this->markTestSkipped("MC-18332: Mysql Search Engine is deprecated and will be removed");
2626
}

dev/tests/integration/testsuite/Magento/CatalogSearch/Model/ResourceModel/Fulltext/CollectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
class CollectionTest extends \PHPUnit\Framework\TestCase
1313
{
14-
protected function setUp()
14+
protected function setUp(): void
1515
{
1616
$this->markTestSkipped("MC-18332: Mysql Search Engine is deprecated and will be removed");
1717
}

dev/tests/integration/testsuite/Magento/Elasticsearch/SearchAdapter/AdapterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class AdapterTest extends \Magento\Framework\Search\Adapter\Mysql\AdapterTest
3131
*/
3232
protected $searchEngine;
3333

34-
protected function setUp()
34+
protected function setUp(): void
3535
{
3636
$this->objectManager = Bootstrap::getObjectManager();
3737

0 commit comments

Comments
 (0)