@@ -323,4 +323,54 @@ public function testRemove()
323
323
324
324
$ this ->model ->remove ();
325
325
}
326
+
327
+ /**
328
+ * Test ignored columns for mview specified at the subscription level
329
+ *
330
+ * @return void
331
+ */
332
+ public function testBuildStatementIgnoredColumnSubscriptionLevel (): void
333
+ {
334
+ $ tableName = 'cataloginventory_stock_item ' ;
335
+ $ ignoredColumnName = 'low_stock_date ' ;
336
+ $ viewId = 'cataloginventory_stock ' ;
337
+ $ ignoredData = [
338
+ $ viewId => [$ tableName => [$ ignoredColumnName ]]
339
+ ];
340
+
341
+ $ this ->connectionMock ->expects ($ this ->once ())
342
+ ->method ('isTableExists ' )
343
+ ->willReturn (true );
344
+ $ this ->connectionMock ->expects ($ this ->once ())
345
+ ->method ('describeTable ' )
346
+ ->willReturn ([
347
+ 'item_id ' => ['COLUMN_NAME ' => 'item_id ' ],
348
+ 'product_id ' => ['COLUMN_NAME ' => 'product_id ' ],
349
+ 'stock_id ' => ['COLUMN_NAME ' => 'stock_id ' ],
350
+ 'qty ' => ['COLUMN_NAME ' => 'qty ' ],
351
+ $ ignoredColumnName => ['COLUMN_NAME ' => $ ignoredColumnName ],
352
+ ]);
353
+
354
+ $ otherChangelogMock = $ this ->getMockForAbstractClass (ChangelogInterface::class);
355
+ $ otherChangelogMock ->expects ($ this ->once ())
356
+ ->method ('getViewId ' )
357
+ ->willReturn ($ viewId );
358
+
359
+ $ model = new Subscription (
360
+ $ this ->resourceMock ,
361
+ $ this ->triggerFactoryMock ,
362
+ $ this ->viewCollectionMock ,
363
+ $ this ->viewMock ,
364
+ $ tableName ,
365
+ 'columnName ' ,
366
+ [],
367
+ $ ignoredData
368
+ );
369
+
370
+ $ method = new \ReflectionMethod ($ model , 'buildStatement ' );
371
+ $ method ->setAccessible (true );
372
+ $ statement = $ method ->invoke ($ model , Trigger::EVENT_UPDATE , $ otherChangelogMock );
373
+
374
+ $ this ->assertStringNotContainsString ($ ignoredColumnName , $ statement );
375
+ }
326
376
}
0 commit comments