-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GraphQL-172: GraphQL modules delivery
-- add block_rollback fixture
- Loading branch information
Valeriy Nayda
committed
Sep 11, 2018
1 parent
ecf79eb
commit 4793553
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
dev/tests/integration/testsuite/Magento/Cms/_files/block_rollback.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
use Magento\Cms\Api\BlockRepositoryInterface; | ||
use Magento\Cms\Api\Data\BlockInterface; | ||
use Magento\Framework\Api\SearchCriteriaBuilder; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
|
||
$objectManager = Bootstrap::getObjectManager(); | ||
|
||
/** @var BlockRepositoryInterface $blockRepository */ | ||
$blockRepository = $objectManager->get(BlockRepositoryInterface::class); | ||
|
||
/** @var SearchCriteriaBuilder $searchCriteriaBuilder */ | ||
$searchCriteriaBuilder = $objectManager->get(SearchCriteriaBuilder::class); | ||
$searchCriteria = $searchCriteriaBuilder->addFilter(BlockInterface::IDENTIFIER, 'fixture_block') | ||
->create(); | ||
$result = $blockRepository->getList($searchCriteria); | ||
|
||
/** | ||
* Tests which are wrapped with MySQL transaction clear all data by transaction rollback. | ||
* In that case there is "if" which checks that "fixture_block" still exists in database. | ||
*/ | ||
foreach ($result->getItems() as $item) { | ||
$blockRepository->delete($item); | ||
} |