/** * @test * @covers PHPSC\Conference\Domain\Service\RegistrationCostCalculator::__construct * @covers PHPSC\Conference\Domain\Service\RegistrationCostCalculator::getBaseCost * @covers PHPSC\Conference\Domain\Service\RegistrationCostCalculator::getVariation * @covers PHPSC\Conference\Domain\Service\RegistrationCostCalculator::getCost * @covers PHPSC\Conference\Domain\Service\RegistrationCostCalculator::getStudentDiscount */ public function getCostShouldApplyDiscountWhenAttendeeHasACoupon() { $this->event->expects($this->any())->method('hasAttendeeRegistration')->willReturn(true); $discount = $this->getMock(DiscountCoupon::class); $discount->expects($this->any())->method('applyDiscountTo')->willReturn(50); $this->attendee->expects($this->any())->method('isStudentRegistration')->willReturn(false); $this->attendee->expects($this->any())->method('canAttendTalksDayOnly')->willReturn(false); $this->attendee->expects($this->any())->method('getDiscount')->willReturn($discount); $this->talkManager->expects($this->any())->method('eventHasAnyApprovedTalk')->willReturn(true); $this->event->expects($this->any())->method('isLateRegistrationPeriod')->willReturn(false); $this->assertEquals(50, $this->calculator->getCost($this->attendee, new DateTime())); }