@@ -136,53 +136,30 @@ public function testResolve(): void
136
136
}
137
137
138
138
/**
139
- *
140
- * @dataProvider resolveDataProvider
141
- * @param $cartId
142
- * @param $maskedId
143
- * @param $expectedResult
144
139
* @return void
145
140
* @throws \Exception
146
141
*/
147
- public function testResolveForException ( $ cartId , $ maskedId , $ expectedResult ): void
142
+ public function testResolveForExceptionWhenQuoteNotExists ( ): void
148
143
{
144
+ $ this ->expectExceptionMessage ('Current user does not have an active cart. ' );
149
145
$ this ->valueMock = ['model ' => $ this ->quoteMock ];
150
- $ this ->quoteMock
151
- ->expects ($ this ->once ())
152
- ->method ('getId ' )
153
- ->willReturn ($ cartId );
154
- if ($ cartId == 0 ) {
155
- $ this ->quoteIdToMaskedQuoteId ->method ('execute ' )->with ($ cartId )->willThrowException (
156
- new NoSuchEntityException (
157
- __ (
158
- 'No such entity with %fieldName = %fieldValue ' ,
159
- [
160
- 'fieldName ' => 'quoteId ' ,
161
- 'fieldValue ' => $ cartId
162
- ]
163
- )
146
+ $ cartId = 0 ;
147
+ $ this ->quoteIdToMaskedQuoteId ->method ('execute ' )->with ($ cartId )->willThrowException (
148
+ new NoSuchEntityException (
149
+ __ (
150
+ 'No such entity with %fieldName = %fieldValue ' ,
151
+ [
152
+ 'fieldName ' => 'quoteId ' ,
153
+ 'fieldValue ' => $ cartId
154
+ ]
164
155
)
165
- );
166
- $ this ->expectExceptionMessage ('Current user does not have an active cart. ' );
167
- }
168
- $ this ->quoteIdToMaskedQuoteId ->method ('execute ' )->with ($ cartId )->willReturn ($ maskedId );
169
- $ result = $ this ->maskedCartId ->resolve (
156
+ )
157
+ );
158
+ $ this ->maskedCartId ->resolve (
170
159
$ this ->fieldMock ,
171
160
$ this ->contextMock ,
172
161
$ this ->resolveInfoMock ,
173
162
$ this ->valueMock
174
163
);
175
- $ this ->assertEquals ($ expectedResult , $ result );
176
- }
177
-
178
- /**
179
- * @return array
180
- */
181
- public function resolveDataProvider (): array
182
- {
183
- return [
184
- [0 , 'noQuoteMaskId ' , '' ],
185
- [1 , 'quoteMaskId ' , 'quoteMaskId ' ]
186
- ];
187
164
}
188
165
}
0 commit comments