Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PriceInfoTest.php
Go to the documentation of this file.
1 <?php
8 
10 
11 class PriceInfoTest extends \PHPUnit\Framework\TestCase
12 {
16  private $priceInfo;
17 
21  private $contextMock;
22 
26  private $extensionFactoryMock;
27 
31  private $registryMock;
32 
36  private $attributeValueFactoryMock;
37 
38  protected function setUp()
39  {
40  $this->contextMock = $this->getMockBuilder(\Magento\Framework\Model\Context::class)
41  ->disableOriginalConstructor()
42  ->getMock();
43 
44  $this->extensionFactoryMock = $this->getMockBuilder(\Magento\Framework\Api\ExtensionAttributesFactory::class)
45  ->disableOriginalConstructor()
46  ->getMock();
47  $this->registryMock = $this->getMockBuilder(\Magento\Framework\Registry::class)
48  ->disableOriginalConstructor()
49  ->getMock();
50 
51  $this->attributeValueFactoryMock = $this->getMockBuilder(\Magento\Framework\Api\AttributeValueFactory::class)
52  ->disableOriginalConstructor()
53  ->getMock();
54 
55  $this->priceInfo = new PriceInfo(
56  $this->contextMock,
57  $this->registryMock,
58  $this->extensionFactoryMock,
59  $this->attributeValueFactoryMock
60  );
61  }
62 
63  public function testGetMaxRegularPrice()
64  {
65  $maxRegularPriceValue = 123;
66 
67  $this->priceInfo->setMaxRegularPrice($maxRegularPriceValue);
68 
69  $this->assertEquals($this->priceInfo->getMaxRegularPrice(), $maxRegularPriceValue);
70  }
71 
72  public function testEmptyMaxRegularPrice()
73  {
74  $maxRegularPriceValue = 123;
75 
76  $this->priceInfo->setMaxPrice($maxRegularPriceValue);
77 
78  $this->assertEquals($this->priceInfo->getMaxRegularPrice(), $maxRegularPriceValue);
79  }
80 
81  public function testGetMinRegularPrice()
82  {
83  $minRegularPriceValue = 13;
84 
85  $this->priceInfo->setMinimalRegularPrice($minRegularPriceValue);
86 
87  $this->assertEquals($this->priceInfo->getMinimalRegularPrice(), $minRegularPriceValue);
88  }
89 
90  public function testEmptyMinRegularPrice()
91  {
92  $minPriceValue = 12;
93 
94  $this->priceInfo->setMinimalPrice($minPriceValue);
95 
96  $this->assertEquals($this->priceInfo->getMinimalRegularPrice(), $minPriceValue);
97  }
98 }