Skip to content
Snippets Groups Projects
Commit b8cd42fa authored by Olexandr Lysenko's avatar Olexandr Lysenko
Browse files

Merge branch 'MAGETWO-60397' into bugfixes

parents 1dc6c4e9 ff20a0da
Branches
No related merge requests found
......@@ -281,7 +281,7 @@ class FlatTableBuilder
if (!empty($columnValueNames)) {
$select->joinLeft(
$temporaryValueTableName,
sprintf('e.%1$s = %2$s.%1$s', $linkField, $temporaryTableName),
sprintf('e.%1$s = %2$s.%1$s', $linkField, $temporaryValueTableName),
$columnValueNames
);
$allColumns = array_merge($allColumns, $columnValueNames);
......
......@@ -107,24 +107,33 @@ class FlatTableBuilderTest extends \PHPUnit_Framework_TestCase
public function testBuild()
{
list($storeId, $changedIds, $valueFieldSuffix, $tableDropSuffix, $fillTmpTables) = [1, [], '', '', true];
$storeId = 1;
$changedIds = [];
$valueFieldSuffix = '_value';
$tableDropSuffix = '';
$fillTmpTables = true;
$tableName = 'catalog_product_entity';
$attributeTable = 'catalog_product_entity_int';
$temporaryTableName = 'catalog_product_entity_int_tmp_indexer';
$temporaryValueTableName = 'catalog_product_entity_int_tmp_indexer';
$temporaryValueTableName = 'catalog_product_entity_int_tmp_indexer_value';
$linkField = 'entity_id';
$statusId = 22;
$eavCustomField = 'space_weight';
$eavCustomValueField = $eavCustomField . $valueFieldSuffix;
$this->flatIndexerMock->expects($this->once())->method('getAttributes')->willReturn([]);
$this->flatIndexerMock->expects($this->exactly(3))->method('getFlatColumns')
->willReturnOnConsecutiveCalls(
[],
[$linkField => []],
[$linkField => []]
[$eavCustomValueField => []],
[$eavCustomValueField => []]
);
$this->flatIndexerMock->expects($this->once())->method('getFlatIndexes')->willReturn([]);
$statusAttributeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute::class)
->disableOriginalConstructor()
->getMock();
$eavCustomAttributeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute::class)
->disableOriginalConstructor()
->getMock();
$this->flatIndexerMock->expects($this->once())->method('getTablesStructure')
->willReturn(
[
......@@ -132,7 +141,8 @@ class FlatTableBuilderTest extends \PHPUnit_Framework_TestCase
$linkField => $statusAttributeMock
],
'catalog_product_entity_int' => [
$linkField => $statusAttributeMock
$linkField => $statusAttributeMock,
$eavCustomField => $eavCustomAttributeMock
]
]
);
......@@ -155,6 +165,9 @@ class FlatTableBuilderTest extends \PHPUnit_Framework_TestCase
$statusAttributeMock->expects($this->atLeastOnce())->method('getBackend')->willReturn(
$backendMock
);
$eavCustomAttributeMock->expects($this->atLeastOnce())->method('getBackend')->willReturn(
$backendMock
);
$statusAttributeMock->expects($this->atLeastOnce())->method('getId')->willReturn($statusId);
$tableMock = $this->getMockBuilder(\Magento\Framework\DB\Ddl\Table::class)
->disableOriginalConstructor()
......@@ -185,12 +198,12 @@ class FlatTableBuilderTest extends \PHPUnit_Framework_TestCase
[
$temporaryTableName,
"e.{$linkField} = {$temporaryTableName}.{$linkField}",
[$linkField]
[$linkField, $eavCustomField]
],
[
$temporaryValueTableName,
"e.{$linkField} = " . $temporaryValueTableName . ".{$linkField}",
[$linkField]
"e.{$linkField} = {$temporaryValueTableName}.{$linkField}",
[$eavCustomValueField]
]
)->willReturnSelf();
$this->metadataPoolMock->expects($this->atLeastOnce())->method('getMetadata')->with(ProductInterface::class)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment