20
20
/**
21
21
* @covers \Magento\Catalog\Cron\DeleteOutdatedPriceValues
22
22
*/
23
- class DeleteOutdatedPriceValuesTest extends \PHPUnit \ Framework \TestCase
23
+ class DeleteOutdatedPriceValuesTest extends \PHPUnit_Framework_TestCase
24
24
{
25
25
/**
26
26
* Testable Object
@@ -90,20 +90,43 @@ public function testExecute()
90
90
$ attributeId = 15 ;
91
91
$ conditions = ['first ' , 'second ' ];
92
92
93
- $ this ->scopeConfigMock ->expects ($ this ->once ())->method ('getValue ' )->with (Store::XML_PATH_PRICE_SCOPE )
93
+ $ this ->scopeConfigMock
94
+ ->expects ($ this ->once ())
95
+ ->method ('getValue ' )
96
+ ->with (Store::XML_PATH_PRICE_SCOPE )
94
97
->willReturn (Store::XML_PATH_PRICE_SCOPE );
95
- $ this ->attributeRepositoryMock ->expects ($ this ->once ())->method ('get ' )
98
+ $ this ->attributeRepositoryMock
99
+ ->expects ($ this ->once ())
100
+ ->method ('get ' )
96
101
->with (ProductAttributeInterface::ENTITY_TYPE_CODE , ProductAttributeInterface::CODE_PRICE )
97
102
->willReturn ($ this ->attributeMock );
98
- $ this ->attributeMock ->expects ($ this ->once ())->method ('getId ' )->willReturn ($ attributeId );
99
- $ this ->attributeMock ->expects ($ this ->once ())->method ('getBackend ' )->willReturn ($ this ->attributeBackendMock );
100
- $ this ->attributeBackendMock ->expects ($ this ->once ())->method ('getTable ' )->willReturn ($ table );
101
- $ this ->resourceConnectionMock ->expects ($ this ->once ())->method ('getConnection ' )->willReturn ($ this ->dbAdapterMock );
102
- $ this ->dbAdapterMock ->expects ($ this ->exactly (2 ))->method ('quoteInto ' )->willReturnMap ([
103
- ['attribute_id = ? ' , $ attributeId , null , null , $ conditions [0 ]],
104
- ['store_id != ? ' , Store::DEFAULT_STORE_ID , null , null , $ conditions [1 ]],
105
- ]);
106
- $ this ->dbAdapterMock ->expects ($ this ->once ())->method ('delete ' )->with ($ table , $ conditions );
103
+ $ this ->attributeMock
104
+ ->expects ($ this ->once ())
105
+ ->method ('getId ' )
106
+ ->willReturn ($ attributeId );
107
+ $ this ->attributeMock
108
+ ->expects ($ this ->once ())
109
+ ->method ('getBackend ' )
110
+ ->willReturn ($ this ->attributeBackendMock );
111
+ $ this ->attributeBackendMock
112
+ ->expects ($ this ->once ())
113
+ ->method ('getTable ' )
114
+ ->willReturn ($ table );
115
+ $ this ->resourceConnectionMock
116
+ ->expects ($ this ->once ())
117
+ ->method ('getConnection ' )
118
+ ->willReturn ($ this ->dbAdapterMock );
119
+ $ this ->dbAdapterMock
120
+ ->expects ($ this ->exactly (2 ))
121
+ ->method ('quoteInto ' )
122
+ ->willReturnMap ([
123
+ ['attribute_id = ? ' , $ attributeId , null , null , $ conditions [0 ]],
124
+ ['store_id != ? ' , Store::DEFAULT_STORE_ID , null , null , $ conditions [1 ]],
125
+ ]);
126
+ $ this ->dbAdapterMock
127
+ ->expects ($ this ->once ())
128
+ ->method ('delete ' )
129
+ ->with ($ table , $ conditions );
107
130
$ this ->deleteOutdatedPriceValues ->execute ();
108
131
}
109
132
@@ -115,10 +138,17 @@ public function testExecute()
115
138
*/
116
139
public function testExecutePriceConfigIsNotSetToGlobal ()
117
140
{
118
- $ this ->scopeConfigMock ->expects ($ this ->once ())->method ('getValue ' )->with (Store::XML_PATH_PRICE_SCOPE )
141
+ $ this ->scopeConfigMock
142
+ ->expects ($ this ->once ())
143
+ ->method ('getValue ' )
144
+ ->with (Store::XML_PATH_PRICE_SCOPE )
119
145
->willReturn (null );
120
- $ this ->attributeRepositoryMock ->expects ($ this ->never ())->method ('get ' );
121
- $ this ->dbAdapterMock ->expects ($ this ->never ())->method ('delete ' );
146
+ $ this ->attributeRepositoryMock
147
+ ->expects ($ this ->never ())
148
+ ->method ('get ' );
149
+ $ this ->dbAdapterMock
150
+ ->expects ($ this ->never ())
151
+ ->method ('delete ' );
122
152
123
153
$ this ->deleteOutdatedPriceValues ->execute ();
124
154
}
0 commit comments