blocks_rollback.php 709 B

1234567891011121314151617181920212223
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. use Magento\Cms\Api\BlockRepositoryInterface;
  8. use Magento\Framework\Exception\NoSuchEntityException;
  9. use Magento\TestFramework\Helper\Bootstrap;
  10. /** @var BlockRepositoryInterface $blockRepository */
  11. $blockRepository = Bootstrap::getObjectManager()->get(BlockRepositoryInterface::class);
  12. foreach (['enabled_block', 'disabled_block'] as $blockId) {
  13. try {
  14. $blockRepository->deleteById($blockId);
  15. } catch (NoSuchEntityException $e) {
  16. /**
  17. * Tests which are wrapped with MySQL transaction clear all data by transaction rollback.
  18. */
  19. }
  20. }