@@ -136,53 +136,30 @@ public function testResolve(): void
136136 }
137137
138138 /**
139- *
140- * @dataProvider resolveDataProvider
141- * @param $cartId
142- * @param $maskedId
143- * @param $expectedResult
144139 * @return void
145140 * @throws \Exception
146141 */
147- public function testResolveForException ( $ cartId , $ maskedId , $ expectedResult ): void
142+ public function testResolveForExceptionWhenQuoteNotExists ( ): void
148143 {
144+ $ this ->expectExceptionMessage ('Current user does not have an active cart. ' );
149145 $ 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+ ]
164155 )
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 (
170159 $ this ->fieldMock ,
171160 $ this ->contextMock ,
172161 $ this ->resolveInfoMock ,
173162 $ this ->valueMock
174163 );
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- ];
187164 }
188165}
0 commit comments