File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed
dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change 44 * See COPYING.txt for license details.
55 */
66
7- use Magento \ TestFramework \ Helper \ Bootstrap ;
7+ declare (strict_types= 1 ) ;
88
9- $ objectManager = Bootstrap::getObjectManager ();
9+ use Magento \Framework \Exception \NoSuchEntityException ;
10+
11+ \Magento \TestFramework \Helper \Bootstrap::getInstance ()->getInstance ()->reinitialize ();
12+
13+ /** @var \Magento\Framework\Registry $registry */
14+ $ registry = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()->get (\Magento \Framework \Registry::class);
15+
16+ $ registry ->unregister ('isSecureArea ' );
17+ $ registry ->register ('isSecureArea ' , true );
18+
19+ /** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
20+ $ productRepository = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()
21+ ->get (\Magento \Catalog \Api \ProductRepositoryInterface::class);
22+ try {
23+ $ product = $ productRepository ->get ('product1 ' , true );
24+ if ($ product ->getId ()) {
25+ $ productRepository ->delete ($ product );
26+ }
27+ } catch (NoSuchEntityException $ e ) {
28+ }
29+ $ registry ->unregister ('isSecureArea ' );
30+ $ registry ->register ('isSecureArea ' , false );
1031
1132require __DIR__ . '/../../Store/_files/store_rollback.php ' ;
1233require __DIR__ . '/../../Store/_files/second_store_rollback.php ' ;
You can’t perform that action at this time.
0 commit comments