/** * @param string $decisionRuleQueryString * @param string $collectorQueryString * @param string $discountType * * @return \Orm\Zed\Discount\Persistence\SpyDiscount */ protected function createDiscountFixtures($decisionRuleQueryString, $collectorQueryString, $discountType = DiscountConstants::TYPE_CART_RULE) { $discountVoucherPool = new SpyDiscountVoucherPool(); $discountVoucherPool->setIsActive(true); $discountVoucherPool->setName('test'); $discountVoucherPool->save(); $discountEntity = new SpyDiscount(); $discountEntity->setAmount(100); $discountEntity->setFkDiscountVoucherPool($discountVoucherPool->getIdDiscountVoucherPool()); $discountEntity->setDecisionRuleQueryString($decisionRuleQueryString); $discountEntity->setCollectorQueryString($collectorQueryString); $discountEntity->setDisplayName('display name'); $discountEntity->setCalculatorPlugin(DiscountDependencyProvider::PLUGIN_CALCULATOR_FIXED); $discountEntity->setDiscountType($discountType); $discountEntity->setIsActive(1); $discountEntity->setValidFrom(new \DateTime('yesterday')); $discountEntity->setValidTo(new \DateTime('tomorrow')); $discountEntity->save(); return $discountEntity; }