@@ -139,9 +139,7 @@ public function testRedirectsAndCustomInput()
139
139
140
140
// generate permanent redirects
141
141
$ renamedKey = 'p002-ren ' ;
142
- $ product ->setUrlKey ($ renamedKey );
143
- $ product ->setData ('save_rewrites_history ' , true );
144
- $ product ->save ();
142
+ $ product ->setUrlKey ($ renamedKey )->setData ('save_rewrites_history ' , true )->save ();
145
143
146
144
$ storeId = $ product ->getStoreId ();
147
145
@@ -219,24 +217,15 @@ public function testRedirectsAndCustomInput()
219
217
$ urlRewriteModel ->setId ($ urlRewriteModel ->getId ());
220
218
$ urlRewriteModel ->save ();
221
219
222
- //modifying query by adding spaces to avoid getting cached values.
223
- $ query
224
- = <<<QUERY
225
- {
226
- urlResolver(url:" {$ customUrl }")
227
- {
228
- id
229
- relative_url
230
- type
231
- }
232
- }
233
- QUERY ;
234
- $ response = $ this ->graphQlQuery ($ query );
235
- $ this ->assertArrayHasKey ('urlResolver ' , $ response );
236
- $ this ->assertEquals ($ product ->getEntityId (), $ response ['urlResolver ' ]['id ' ]);
237
- $ this ->assertEquals ($ actualUrls ->getRequestPath (), $ response ['urlResolver ' ]['relative_url ' ]);
238
- $ this ->assertEquals (strtoupper ($ actualUrls ->getEntityType ()), $ response ['urlResolver ' ]['type ' ]);
220
+ ObjectManager::getInstance ()->get (\Magento \TestFramework \Helper \CacheCleaner::class)->cleanAll ();
239
221
222
+ //modifying query by adding spaces to avoid getting cached values.
223
+ $ this ->assertResponseFromGraphQl (
224
+ (int ) $ product ->getEntityId (),
225
+ $ customUrl ,
226
+ $ actualUrls ->getRequestPath (),
227
+ strtoupper ($ actualUrls ->getEntityType ())
228
+ );
240
229
$ urlRewriteModel ->delete ();
241
230
}
242
231
0 commit comments