示例#1
0
 /**
  * @param int $productId
  * @param float $quantity
  * @param string $unitCode
  * @param int $priceType
  * @param Price $price
  * @return QuoteProductOffer
  */
 protected function getQuoteProductOffer($productId = null, $quantity = null, $unitCode = null, $priceType = null, Price $price = null)
 {
     $quoteProductOffer = new QuoteProductOffer();
     $quoteProductOffer->setQuoteProduct($this->getQuoteProduct($productId));
     if (null !== $quantity) {
         $quoteProductOffer->setQuantity($quantity);
     }
     if (null !== $unitCode) {
         $quoteProductOffer->setProductUnit($this->getEntity('OroB2B\\Bundle\\ProductBundle\\Entity\\ProductUnit', $unitCode, 'code'));
     }
     if (null !== $priceType) {
         $quoteProductOffer->setPriceType($priceType);
     }
     if (null !== $price) {
         $quoteProductOffer->setPrice($price);
     }
     return $quoteProductOffer;
 }
 /**
  * @return array
  */
 public function hasQuoteProductOfferByPriceTypeDataProvider()
 {
     $unitOffer = new QuoteProductOffer();
     $unitOffer->setPriceType(QuoteProductOffer::PRICE_TYPE_UNIT);
     $firstBundledOffer = new QuoteProductOffer();
     $firstBundledOffer->setPriceType(QuoteProductOffer::PRICE_TYPE_BUNDLED);
     $secondBundledOffer = new QuoteProductOffer();
     $secondBundledOffer->setPriceType(QuoteProductOffer::PRICE_TYPE_BUNDLED);
     return ['true' => ['offers' => [$unitOffer, $firstBundledOffer, $secondBundledOffer], 'type' => QuoteProductOffer::PRICE_TYPE_UNIT, 'expected' => true], 'false' => ['offers' => [$firstBundledOffer, $secondBundledOffer], 'type' => QuoteProductOffer::PRICE_TYPE_UNIT, 'expected' => false]];
 }