Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CreateWidgetsEntityTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Fixture\FixtureFactory;
10 use \Magento\Mtf\TestCase\Injectable;
12 
21 class CreateWidgetsEntityTest extends Injectable
22 {
23  /* tags */
24  const SEVERITY = 'S3';
25  /* end tags */
26 
34  public function test(array $widgets, FixtureFactory $fixtureFactory)
35  {
37  $widgetInstances = [];
38  // Preconditions
39  foreach ($widgets as $widget) {
40  $widget = $fixtureFactory->createByCode('widget', ['dataset' => $widget]);
41  $widget->persist();
42  $widgetInstances[] = $widget;
43  }
44 
45  return ['widgets' => $widgetInstances];
46  }
47 
53  public function tearDown()
54  {
55  $this->objectManager->create(\Magento\Widget\Test\TestStep\DeleteAllWidgetsStep::class)->run();
56  }
57 }