Skip to content

Commit

Permalink
MSI: issue #290
Browse files Browse the repository at this point in the history
- Fixed setup schema script for creatind default source;
- Tests fexes - part;
  • Loading branch information
deadlexus committed Dec 20, 2017
1 parent c070521 commit bb971db
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
6 changes: 5 additions & 1 deletion app/code/Magento/Inventory/Indexer/SelectBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ public function execute($stockId): Select
)
->joinLeft(
['stock_source_link' => $sourceStockLinkTable],
'source_item.' . SourceItemInterface::SOURCE_CODE . ' = stock_source_link.' . StockSourceLink::SOURCE_CODE,
sprintf(
'source_item.%s = stock_source_link.%s',
SourceItemInterface::SOURCE_CODE,
StockSourceLink::SOURCE_CODE
),
[]
)
->where('stock_source_link.' . StockSourceLink::STOCK_ID . ' = ?', $stockId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ public function execute(array $sourceItemIds): array
]
)->joinInner(
['stock_source_link' => $sourceStockLinkTable],
'source_item.' . SourceItemInterface::SOURCE_CODE . ' = stock_source_link.' . StockSourceLink::SOURCE_CODE,
sprintf(
'source_item.%s = stock_source_link.%s',
SourceItemInterface::SOURCE_CODE,
StockSourceLink::SOURCE_CODE
),
[StockSourceLink::STOCK_ID]
)->where('source_item.source_item_id IN (?)', $sourceItemIds)
->group(['stock_source_link.' . StockSourceLink::STOCK_ID]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private function createSourceCarrierLinkTable(SchemaSetupInterface $setup): Tabl
],
'Source Carrier Link ID'
)->addColumn(
SourceInterface::CODE,
SourceCarrierLinkInterface::SOURCE_CODE,
Table::TYPE_TEXT,
255,
[
Expand All @@ -80,11 +80,11 @@ private function createSourceCarrierLinkTable(SchemaSetupInterface $setup): Tabl
)->addForeignKey(
$setup->getFkName(
$sourceCarrierLinkTable,
SourceInterface::CODE,
SourceCarrierLinkInterface::SOURCE_CODE,
$sourceTable,
SourceInterface::CODE
),
SourceInterface::CODE,
SourceCarrierLinkInterface::SOURCE_CODE,
$sourceTable,
SourceInterface::CODE,
AdapterInterface::FK_ACTION_CASCADE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function testGet()
$this->commandGet
->expects($this->once())
->method('execute')
->with($sourceId)
->with($sourceCode)
->willReturn($this->source);

self::assertEquals($this->source, $this->sourceRepository->get($sourceCode));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface SourceCarrierLinkInterface extends ExtensibleDataInterface
*/
const CARRIER_CODE = 'carrier_code';
const POSITION = 'position';
const SOURCE_CODE = 'source_code';
/**#@-*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public function __construct(
public function execute()
{
$data = [
SourceInterface::SOURCE_ID => $this->defaultSourceProvider->getId(),
SourceInterface::CODE => 'default',
SourceInterface::NAME => 'Default Source',
SourceInterface::ENABLED => 1,
Expand Down

0 comments on commit bb971db

Please sign in to comment.