Skip to content

Commit 4793553

Browse files
author
Valeriy Nayda
committed
GraphQL-172: GraphQL modules delivery
-- add block_rollback fixture
1 parent ecf79eb commit 4793553

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
use Magento\Cms\Api\BlockRepositoryInterface;
9+
use Magento\Cms\Api\Data\BlockInterface;
10+
use Magento\Framework\Api\SearchCriteriaBuilder;
11+
use Magento\TestFramework\Helper\Bootstrap;
12+
13+
$objectManager = Bootstrap::getObjectManager();
14+
15+
/** @var BlockRepositoryInterface $blockRepository */
16+
$blockRepository = $objectManager->get(BlockRepositoryInterface::class);
17+
18+
/** @var SearchCriteriaBuilder $searchCriteriaBuilder */
19+
$searchCriteriaBuilder = $objectManager->get(SearchCriteriaBuilder::class);
20+
$searchCriteria = $searchCriteriaBuilder->addFilter(BlockInterface::IDENTIFIER, 'fixture_block')
21+
->create();
22+
$result = $blockRepository->getList($searchCriteria);
23+
24+
/**
25+
* Tests which are wrapped with MySQL transaction clear all data by transaction rollback.
26+
* In that case there is "if" which checks that "fixture_block" still exists in database.
27+
*/
28+
foreach ($result->getItems() as $item) {
29+
$blockRepository->delete($item);
30+
}

0 commit comments

Comments
 (0)