bookmarks.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. use Magento\Ui\Api\Data\BookmarkInterface;
  7. use Magento\Ui\Model\Bookmark;
  8. $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
  9. $bookmarks = [
  10. [
  11. 'user_id' => 1,
  12. 'namespace' => 'bm_namespace',
  13. 'identifier' => 'first',
  14. 'current' => 1,
  15. 'config' => '{}',
  16. 'title' => 'Bb'
  17. ],
  18. [
  19. 'user_id' => 1,
  20. 'namespace' => 'bm_namespace',
  21. 'identifier' => 'second',
  22. 'current' => 0,
  23. 'config' => '{1}',
  24. 'title' => 'Aa'
  25. ],
  26. [
  27. 'user_id' => 1,
  28. 'namespace' => 'new_namespace',
  29. 'identifier' => 'third',
  30. 'current' => 1,
  31. 'config' => '{}',
  32. 'title' => 'Default View'
  33. ],
  34. ];
  35. foreach ($bookmarks as $bookmarkData) {
  36. /** @var Bookmark $bookmark */
  37. $bookmark = $objectManager->create(BookmarkInterface::class);
  38. $bookmark
  39. ->setData($bookmarkData)
  40. ->save();
  41. }