1818use Magento \Framework \EntityManager \MetadataPool ;
1919use Magento \Framework \Stdlib \DateTime ;
2020use Magento \Framework \Stdlib \DateTime \TimezoneInterface ;
21- use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
2221use Magento \Indexer \Model \Indexer ;
2322use Magento \Store \Model \Store ;
2423use Magento \Store \Model \StoreManagerInterface ;
3029 */
3130class RefreshSpecialPricesTest extends TestCase
3231{
33- /**
34- * @var ObjectManager
35- */
36- protected $ _objectManager ;
37-
3832 /**
3933 * @var RefreshSpecialPrices
4034 */
@@ -82,8 +76,6 @@ class RefreshSpecialPricesTest extends TestCase
8276
8377 protected function setUp (): void
8478 {
85- $ this ->_objectManager = new ObjectManager ($ this );
86-
8779 $ this ->_storeManagerMock = $ this ->getMockForAbstractClass (StoreManagerInterface::class);
8880 $ this ->_resourceMock = $ this ->createMock (ResourceConnection::class);
8981 $ this ->_dateTimeMock = $ this ->createMock (DateTime::class);
@@ -93,16 +85,13 @@ protected function setUp(): void
9385
9486 $ this ->metadataMock = $ this ->createMock (EntityMetadata::class);
9587
96- $ this ->_model = $ this ->_objectManager ->getObject (
97- RefreshSpecialPrices::class,
98- [
99- 'storeManager ' => $ this ->_storeManagerMock ,
100- 'resource ' => $ this ->_resourceMock ,
101- 'dateTime ' => $ this ->_dateTimeMock ,
102- 'localeDate ' => $ this ->_localeDateMock ,
103- 'eavConfig ' => $ this ->_eavConfigMock ,
104- 'processor ' => $ this ->_priceProcessorMock
105- ]
88+ $ this ->_model = new RefreshSpecialPrices (
89+ $ this ->_storeManagerMock ,
90+ $ this ->_resourceMock ,
91+ $ this ->_dateTimeMock ,
92+ $ this ->_localeDateMock ,
93+ $ this ->_eavConfigMock ,
94+ $ this ->_priceProcessorMock
10695 );
10796
10897 $ this ->metadataPool = $ this ->createMock (MetadataPool::class);
@@ -132,13 +121,10 @@ public function testRefreshSpecialPrices()
132121
133122 $ connectionMock = $ this ->getMockForAbstractClass (AdapterInterface::class);
134123 $ connectionMock ->expects ($ this ->any ())->method ('select ' )->willReturn ($ selectMock );
135- $ connectionMock ->expects (
136- $ this ->any ()
137- )->method (
138- 'fetchCol '
139- )->willReturn (
140- $ idsToProcess
141- );
124+ $ connectionMock ->expects ($ this ->exactly (2 ))
125+ ->method ('fetchCol ' )
126+ ->with ($ selectMock , [])
127+ ->willReturn ($ idsToProcess );
142128
143129 $ this ->_resourceMock ->expects (
144130 $ this ->once ()
0 commit comments