@@ -31,32 +31,32 @@ class ReviewTest extends \PHPUnit_Framework_TestCase
31
31
/**
32
32
* @var \Magento\Review\Model\ResourceModel\Review\Collection|\PHPUnit_Framework_MockObject_MockObject
33
33
*/
34
- private $ collectionMock ;
34
+ private $ collection ;
35
35
36
36
/**
37
37
* @var \Magento\Review\Model\ResourceModel\Review\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject
38
38
*/
39
- private $ collectionFactoryMock ;
39
+ private $ collectionFactory ;
40
40
41
41
/**
42
42
* @var \Magento\Framework\Registry|\PHPUnit_Framework_MockObject_MockObject
43
43
*/
44
- private $ registryMock ;
44
+ private $ registry ;
45
45
46
46
/**
47
47
* @var \Magento\Catalog\Model\Product|\PHPUnit_Framework_MockObject_MockObject
48
48
*/
49
- private $ productMock ;
49
+ private $ product ;
50
50
51
51
/**
52
- * @var \Magento\Framework\View\Element\Template\Context |\PHPUnit_Framework_MockObject_MockObject
52
+ * @var \Magento\Store\Model\StoreManager |\PHPUnit_Framework_MockObject_MockObject
53
53
*/
54
- private $ contextMock ;
54
+ private $ storeManager ;
55
55
56
56
/**
57
- * @va rMagento \Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject
57
+ * @var \Magento \Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject
58
58
*/
59
- private $ storeMock ;
59
+ private $ store ;
60
60
61
61
protected function setUp ()
62
62
{
@@ -66,9 +66,9 @@ protected function setUp()
66
66
67
67
$ helper = new ObjectManager ($ this );
68
68
$ this ->block = $ helper ->getObject (ReviewBlock::class, [
69
- 'context ' => $ this ->contextMock ,
70
- 'registry ' => $ this ->registryMock ,
71
- 'collectionFactory ' => $ this ->collectionFactoryMock ,
69
+ 'storeManager ' => $ this ->storeManager ,
70
+ 'registry ' => $ this ->registry ,
71
+ 'collectionFactory ' => $ this ->collectionFactory ,
72
72
]);
73
73
}
74
74
@@ -85,32 +85,32 @@ public function testGetIdentities()
85
85
*/
86
86
private function initCollectionMocks ()
87
87
{
88
- $ this ->collectionMock = $ this ->getMockBuilder (Collection::class)
88
+ $ this ->collection = $ this ->getMockBuilder (Collection::class)
89
89
->disableOriginalConstructor ()
90
90
->setMethods (['addStoreFilter ' , 'addStatusFilter ' , 'addEntityFilter ' , 'getSize ' , '__wakeup ' ])
91
91
->getMock ();
92
92
93
- $ this ->collectionMock ->expects (static ::any ())
93
+ $ this ->collection ->expects (static ::any ())
94
94
->method ('addStoreFilter ' )
95
95
->willReturnSelf ();
96
96
97
- $ this ->collectionMock ->expects (static ::any ())
97
+ $ this ->collection ->expects (static ::any ())
98
98
->method ('addStatusFilter ' )
99
99
->with (Review::STATUS_APPROVED )
100
100
->willReturnSelf ();
101
101
102
- $ this ->collectionMock ->expects (static ::any ())
102
+ $ this ->collection ->expects (static ::any ())
103
103
->method ('addEntityFilter ' )
104
104
->willReturnSelf ();
105
105
106
- $ this ->collectionFactoryMock = $ this ->getMockBuilder (CollectionFactory::class)
106
+ $ this ->collectionFactory = $ this ->getMockBuilder (CollectionFactory::class)
107
107
->disableOriginalConstructor ()
108
108
->setMethods (['create ' , '__wakeup ' ])
109
109
->getMock ();
110
110
111
- $ this ->collectionFactoryMock ->expects (static ::once ())
111
+ $ this ->collectionFactory ->expects (static ::once ())
112
112
->method ('create ' )
113
- ->willReturn ($ this ->collectionMock );
113
+ ->willReturn ($ this ->collection );
114
114
}
115
115
116
116
/**
@@ -119,23 +119,23 @@ private function initCollectionMocks()
119
119
private function initRegistryMock ()
120
120
{
121
121
$ this ->initProductMock ();
122
- $ this ->registryMock = $ this ->getMockBuilder (Registry::class)
122
+ $ this ->registry = $ this ->getMockBuilder (Registry::class)
123
123
->disableOriginalConstructor ()
124
124
->setMethods (['registry ' ])
125
125
->getMock ();
126
126
127
- $ this ->registryMock ->expects (static ::once ())
127
+ $ this ->registry ->expects (static ::once ())
128
128
->method ('registry ' )
129
129
->with ('product ' )
130
- ->willReturn ($ this ->productMock );
130
+ ->willReturn ($ this ->product );
131
131
}
132
132
133
133
/**
134
134
* Create mock object for catalog product
135
135
*/
136
136
private function initProductMock ()
137
137
{
138
- $ this ->productMock = $ this ->getMockBuilder (Product::class)
138
+ $ this ->product = $ this ->getMockBuilder (Product::class)
139
139
->disableOriginalConstructor ()
140
140
->setMethods (['getId ' ])
141
141
->getMock ();
@@ -146,27 +146,18 @@ private function initProductMock()
146
146
*/
147
147
private function initContextMock ()
148
148
{
149
- $ this ->storeMock = $ this ->getMockBuilder (Store::class)
149
+ $ this ->store = $ this ->getMockBuilder (Store::class)
150
150
->disableOriginalConstructor ()
151
151
->setMethods (['getId ' , '__wakeup ' ])
152
152
->getMock ();
153
153
154
- $ storeManager = $ this ->getMockBuilder (StoreManager::class)
154
+ $ this -> storeManager = $ this ->getMockBuilder (StoreManager::class)
155
155
->disableOriginalConstructor ()
156
156
->setMethods (['getStore ' , '__wakeup ' ])
157
157
->getMock ();
158
158
159
- $ storeManager ->expects (static ::once ())
159
+ $ this -> storeManager ->expects (static ::any ())
160
160
->method ('getStore ' )
161
- ->willReturn ($ this ->storeMock );
162
-
163
- $ this ->contextMock = $ this ->getMockBuilder (Context::class)
164
- ->disableOriginalConstructor ()
165
- ->setMethods (['getStoreManager ' ])
166
- ->getMock ();
167
-
168
- $ this ->contextMock ->expects (static ::once ())
169
- ->method ('getStoreManager ' )
170
- ->willReturn ($ storeManager );
161
+ ->willReturn ($ this ->store );
171
162
}
172
163
}
0 commit comments