Skip to content

Commit 11f013c

Browse files
committed
Fix #14958 - remove requirement of magento/module-store
1 parent 76b2085 commit 11f013c

File tree

4 files changed

+8
-26
lines changed

4 files changed

+8
-26
lines changed

app/code/Magento/SalesSequence/Model/Sequence/DeleteByStore.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use Magento\Framework\App\ResourceConnection as AppResource;
1111
use Magento\SalesSequence\Model\MetaFactory;
1212
use Magento\SalesSequence\Model\ResourceModel\Meta as ResourceMetadata;
13-
use Magento\Store\Api\Data\StoreInterface;
1413

1514
/**
1615
* Class DeleteByStore
@@ -50,13 +49,13 @@ public function __construct(
5049
/**
5150
* Deletes all sequence linked entites
5251
*
53-
* @param StoreInterface $store
52+
* @param int $storeId
5453
* @return void
5554
* @throws \Exception
5655
*/
57-
public function execute(StoreInterface $store): void
56+
public function execute($storeId): void
5857
{
59-
$metadataIds = $this->getMetadataIdsByStoreId($store->getId());
58+
$metadataIds = $this->getMetadataIdsByStoreId($storeId);
6059
$profileIds = $this->getProfileIdsByMetadataIds($metadataIds);
6160

6261
$this->appResource->getConnection()->delete(

app/code/Magento/SalesSequence/Observer/SequenceRemovalObserver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ public function __construct(
3939
*/
4040
public function execute(EventObserver $observer)
4141
{
42-
$this->deleteByStore->execute($observer->getData('store'));
42+
if ($store = $observer->getData('store')) {
43+
$this->deleteByStore->execute($store->getId());
44+
}
4345

4446
return $this;
4547
}

app/code/Magento/SalesSequence/Test/Unit/Model/Sequence/DeleteByStoreTest.php

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use Magento\SalesSequence\Model\MetaFactory;
1414
use Magento\SalesSequence\Model\ResourceModel\Meta as ResourceMeta;
1515
use Magento\SalesSequence\Model\Sequence\DeleteByStore;
16-
use Magento\Store\Api\Data\StoreInterface;
1716
use PHPUnit\Framework\MockObject\MockObject;
1817
use PHPUnit\Framework\TestCase;
1918

@@ -57,11 +56,6 @@ class DeleteByStoreTest extends TestCase
5756
*/
5857
private $select;
5958

60-
/**
61-
* @var StoreInterface | MockObject
62-
*/
63-
private $store;
64-
6559
protected function setUp()
6660
{
6761
$this->connectionMock = $this->getMockForAbstractClass(
@@ -85,15 +79,6 @@ protected function setUp()
8579
$this->select = $this->createMock(Select::class);
8680
$this->metaFactory = $this->createPartialMock(MetaFactory::class, ['create']);
8781
$this->metaFactory->expects($this->any())->method('create')->willReturn($this->meta);
88-
$this->store = $this->getMockForAbstractClass(
89-
StoreInterface::class,
90-
[],
91-
'',
92-
false,
93-
false,
94-
true,
95-
['getId']
96-
);
9782

9883
$helper = new ObjectManager($this);
9984
$this->deleteByStore = $helper->getObject(
@@ -112,9 +97,6 @@ public function testExecute()
11297
$storeId = 1;
11398
$metadataIds = [1, 2];
11499
$profileIds = [10, 11];
115-
$this->store->expects($this->once())
116-
->method('getId')
117-
->willReturn($storeId);
118100
$this->resourceMock->method('getTableName')
119101
->willReturnCallback(static function ($tableName) {
120102
return $tableName;
@@ -155,6 +137,6 @@ static function ($arg, $arg2) use ($metadataIds, $profileIds) {
155137
$this->resourceSequenceMeta->expects($this->any())
156138
->method('delete')
157139
->willReturn($this->resourceSequenceMeta);
158-
$this->deleteByStore->execute($this->store);
140+
$this->deleteByStore->execute($storeId);
159141
}
160142
}

app/code/Magento/SalesSequence/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
},
77
"require": {
88
"php": "~7.1.3||~7.2.0",
9-
"magento/framework": "*",
10-
"magento/module-store": "*"
9+
"magento/framework": "*"
1110
},
1211
"type": "magento2-module",
1312
"license": [

0 commit comments

Comments
 (0)