UpdateTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Widget\Model\Layout;
  7. class UpdateTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /**
  10. * @var \Magento\Widget\Model\Layout\Update
  11. */
  12. protected $_model;
  13. protected function setUp()
  14. {
  15. $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
  16. \Magento\Widget\Model\Layout\Update::class
  17. );
  18. }
  19. public function testConstructor()
  20. {
  21. $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
  22. \Magento\Widget\Model\Layout\Update::class
  23. );
  24. $this->assertInstanceOf(
  25. \Magento\Widget\Model\ResourceModel\Layout\Update::class,
  26. $this->_model->getResource()
  27. );
  28. }
  29. /**
  30. * @magentoDbIsolation enabled
  31. */
  32. public function testCrud()
  33. {
  34. $this->_model->setData(['handle' => 'default', 'xml' => '<layout/>', 'sort_order' => 123]);
  35. $entityHelper = new \Magento\TestFramework\Entity(
  36. $this->_model,
  37. ['handle' => 'custom', 'xml' => '<layout version="0.1.0"/>', 'sort_order' => 456]
  38. );
  39. $entityHelper->testCrud();
  40. }
  41. }