Skip to content

Commit

Permalink
GraphQL-172: GraphQL modules delivery
Browse files Browse the repository at this point in the history
-- 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.
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);
}

0 comments on commit 4793553

Please sign in to comment.