File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
dev/tests/integration/testsuite/Magento/Cms/_files Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments