Пример #1
0
 /**
  * @param \Generated\Shared\Transfer\DiscountVoucherTransfer $discountVoucherTransfer
  * @param string $code
  *
  * @return string
  */
 protected function addCustomCodeToGenerated(DiscountVoucherTransfer $discountVoucherTransfer, $code)
 {
     $customCode = $discountVoucherTransfer->getCustomCode();
     $replacementString = $this->discountConfig->getVoucherPoolTemplateReplacementString();
     if (!$customCode) {
         return $code;
     }
     if (!strstr($customCode, $replacementString)) {
         return $customCode . $code;
     }
     return str_replace($replacementString, $code, $customCode);
 }
Пример #2
0
 /**
  * @param \PHPUnit_Framework_MockObject_MockObject|\Spryker\Zed\Discount\DiscountConfig $discountConfigMock
  *
  * @return void
  */
 protected function configureDiscountConfigMock(DiscountConfig $discountConfigMock)
 {
     $discountConfigMock->method('getVoucherCodeCharacters')->willReturn($this->getVoucherCodeCharacters());
     $discountConfigMock->method('getVoucherPoolTemplateReplacementString')->willReturn('[template]');
 }