RuleTest.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\SalesRule\Test\Unit\Model\Plugin\ResourceModel;
  7. class RuleTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /**
  10. * @var \Magento\SalesRule\Model\Plugin\ResourceModel\Rule
  11. */
  12. protected $plugin;
  13. /**
  14. * @var \PHPUnit_Framework_MockObject_MockObject
  15. */
  16. protected $ruleResource;
  17. /**
  18. * @var \Closure
  19. */
  20. protected $genericClosure;
  21. /**
  22. * @var \PHPUnit_Framework_MockObject_MockObject
  23. */
  24. protected $abstractModel;
  25. protected function setUp()
  26. {
  27. $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
  28. $this->ruleResource = $this->getMockBuilder(\Magento\SalesRule\Model\ResourceModel\Rule::class)
  29. ->disableOriginalConstructor()
  30. ->getMock();
  31. $this->genericClosure = function () {
  32. return;
  33. };
  34. $this->abstractModel = $this->getMockBuilder(\Magento\Framework\Model\AbstractModel::class)
  35. ->disableOriginalConstructor()
  36. ->getMockForAbstractClass();
  37. $this->plugin = $objectManager->getObject(\Magento\SalesRule\Model\Plugin\ResourceModel\Rule::class);
  38. }
  39. public function testAroundLoadCustomerGroupIds()
  40. {
  41. $this->assertEquals(
  42. $this->ruleResource,
  43. $this->plugin->aroundLoadCustomerGroupIds($this->ruleResource, $this->genericClosure, $this->abstractModel)
  44. );
  45. }
  46. public function testAroundLoadWebsiteIds()
  47. {
  48. $this->assertEquals(
  49. $this->ruleResource,
  50. $this->plugin->aroundLoadWebsiteIds($this->ruleResource, $this->genericClosure, $this->abstractModel)
  51. );
  52. }
  53. }