@@ -463,8 +463,14 @@ private function verifySelectAllOptions(
463
463
->disableOriginalConstructor ()
464
464
->getMock ();
465
465
466
+ $ storeId = '1 ' ;
467
+ $ storeManagerMock = $ this ->getMockBuilder (StoreManagerInterface::class)->getMock ();
468
+ $ storeMock = $ this ->getMockBuilder (StoreInterface::class)->getMock ();
469
+ $ storeMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ($ storeId );
470
+ $ storeManagerMock ->expects ($ this ->atLeastOnce ())->method ('getStore ' )->willReturn ($ storeMock );
466
471
$ attrOptionFactory = $ this ->createPartialMock (OptionFactory::class, ['create ' ]);
467
472
473
+ $ attributeId = '42 ' ;
468
474
$ abstractAttributeMock = $ this ->getMockBuilder (AbstractAttribute::class)
469
475
->addMethods (['getStoreId ' ])
470
476
->onlyMethods (
@@ -475,21 +481,7 @@ private function verifySelectAllOptions(
475
481
)
476
482
->disableOriginalConstructor ()
477
483
->getMock ();
478
-
479
- $ storeManagerMock = $ this ->getMockBuilder (StoreManagerInterface::class)->getMock ();
480
- $ storeMock = $ this ->getMockBuilder (StoreInterface::class)->getMock ();
481
-
482
- $ attrObjectSourceMock = new Table ($ collectionFactory , $ attrOptionFactory , $ storeManagerMock );
483
- $ attrObjectSourceMock ->setAttribute ($ abstractAttributeMock );
484
-
485
- $ storeId = '1 ' ;
486
- $ attributeId = '42 ' ;
487
-
488
484
$ abstractAttributeMock ->expects ($ this ->atLeastOnce ())->method ('getStoreId ' )->willReturn (null );
489
-
490
- $ storeManagerMock ->expects ($ this ->atLeastOnce ())->method ('getStore ' )->willReturn ($ storeMock );
491
- $ storeMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ($ storeId );
492
-
493
485
$ abstractAttributeMock ->expects ($ this ->atLeastOnce ())->method ('getId ' )->willReturn ($ attributeId );
494
486
495
487
$ collectionFactory ->expects ($ this ->once ())
@@ -518,6 +510,8 @@ private function verifySelectAllOptions(
518
510
]
519
511
);
520
512
513
+ $ attrObjectSourceMock = new Table ($ collectionFactory , $ attrOptionFactory , $ storeManagerMock );
514
+ $ attrObjectSourceMock ->setAttribute ($ abstractAttributeMock );
521
515
$ allOptionsValue = $ attrObjectSourceMock ->getAllOptions ($ expectedAttrObjSourceAllOptionsParam , true );
522
516
$ this ->assertEquals ($ attrObjectSourceAllOptionsValue , $ allOptionsValue );
523
517
return $ attrObjectSourceMock ;
0 commit comments