Ejemplo n.º 1
0
 public function testDiscountFixedAmountInvalidParameter()
 {
     $subjectMock = $this->getSubjectMock('addOrderDiscount');
     $subjectMock->expects($this->never())->method('addOrderDiscount');
     $action = new DiscountFixedAmountAction();
     $action->initialize('orale');
     $action->perform($subjectMock);
 }
Ejemplo n.º 2
0
 public function testPromotionApply()
 {
     $discountAction = new DiscountFixedAmountAction();
     $discountAction->initialize(20);
     $actions = array($discountAction, new FreeShippingAction());
     $subjectMock = $this->getMock('\\Balalaika\\TestPromotionSubject', array('addOrderDiscount', 'setFreeShipping'));
     $subjectMock->expects($this->once())->method('addOrderDiscount');
     $subjectMock->expects($this->once())->method('setFreeShipping');
     $promotion = new Promotion('Lala');
     $promotion->setActions($actions);
     $this->assertTrue($promotion->isEligible($subjectMock));
     $promotion->apply($subjectMock);
 }