Ejemplo n.º 1
0
 /**
  * test method getValue
  *
  * @dataProvider getValueDataProvider
  */
 public function testGetValue($specialPriceValue, $expectedResult)
 {
     $this->priceInfoMock->expects($this->once())->method('getPrices')->will($this->returnValue($this->prices));
     $this->regularPriceMock->expects($this->exactly(3))->method('getValue')->will($this->returnValue(100));
     $this->tearPriceMock->expects($this->exactly(2))->method('getValue')->will($this->returnValue(99));
     $this->specialPriceMock->expects($this->any())->method('getValue')->will($this->returnValue($specialPriceValue));
     $this->assertSame($expectedResult, $this->basePrice->getValue());
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getValue()
 {
     $selectedConfigurableOption = $this->product->getSelectedConfigurableOption();
     $productId = $selectedConfigurableOption ? $selectedConfigurableOption->getId() : $this->product->getId();
     if (!isset($this->values[$productId])) {
         $this->value = null;
         if (!$selectedConfigurableOption) {
             $this->values[$productId] = parent::getValue();
         } else {
             if (false !== $this->getMinimumAdditionalPrice()) {
                 $this->values[$productId] = $this->getMinimumAdditionalPrice();
             } else {
                 $this->values[$productId] = parent::getValue();
             }
         }
     }
     return $this->values[$productId];
 }
Ejemplo n.º 3
0
 /**
  * Get Value
  *
  * @return float|bool
  */
 public function getValue()
 {
     return max(0, $this->basePrice->getValue());
 }