18
18
use Magento \Framework \EntityManager \MetadataPool ;
19
19
use Magento \Framework \Stdlib \DateTime ;
20
20
use Magento \Framework \Stdlib \DateTime \TimezoneInterface ;
21
- use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
22
21
use Magento \Indexer \Model \Indexer ;
23
22
use Magento \Store \Model \Store ;
24
23
use Magento \Store \Model \StoreManagerInterface ;
30
29
*/
31
30
class RefreshSpecialPricesTest extends TestCase
32
31
{
33
- /**
34
- * @var ObjectManager
35
- */
36
- protected $ _objectManager ;
37
-
38
32
/**
39
33
* @var RefreshSpecialPrices
40
34
*/
@@ -82,8 +76,6 @@ class RefreshSpecialPricesTest extends TestCase
82
76
83
77
protected function setUp (): void
84
78
{
85
- $ this ->_objectManager = new ObjectManager ($ this );
86
-
87
79
$ this ->_storeManagerMock = $ this ->getMockForAbstractClass (StoreManagerInterface::class);
88
80
$ this ->_resourceMock = $ this ->createMock (ResourceConnection::class);
89
81
$ this ->_dateTimeMock = $ this ->createMock (DateTime::class);
@@ -93,16 +85,13 @@ protected function setUp(): void
93
85
94
86
$ this ->metadataMock = $ this ->createMock (EntityMetadata::class);
95
87
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
106
95
);
107
96
108
97
$ this ->metadataPool = $ this ->createMock (MetadataPool::class);
@@ -132,13 +121,10 @@ public function testRefreshSpecialPrices()
132
121
133
122
$ connectionMock = $ this ->getMockForAbstractClass (AdapterInterface::class);
134
123
$ 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 );
142
128
143
129
$ this ->_resourceMock ->expects (
144
130
$ this ->once ()
0 commit comments