diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/FlatTableBuilderTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/FlatTableBuilderTest.php
index 7e5a8305467e8e979a9ccc79d39d7ffdb70bb339..83b6a7ac8eb481f406469dc3c13dc425d2cb279d 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/FlatTableBuilderTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Flat/FlatTableBuilderTest.php
@@ -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)