/**
  * @param InstructionInterface $instruction
  *
  * @return int
  */
 private function calculatePossibleGenerationAmount(InstructionInterface $instruction)
 {
     $expectedAmount = $instruction->getAmount();
     $expectedCodeLength = $instruction->getCodeLength();
     Assert::allNotNull([$expectedAmount, $expectedCodeLength], 'Code length or amount cannot be null.');
     $generatedAmount = $this->couponRepository->countCouponsByCodeLength($expectedCodeLength);
     return floor(pow(16, $expectedCodeLength) * $this->ratio - $generatedAmount);
 }
 function it_returns_possible_generation_amount(InstructionInterface $instruction, CouponRepositoryInterface $couponRepository)
 {
     $instruction->getAmount()->willReturn(17);
     $instruction->getCodeLength()->willReturn(1);
     $couponRepository->countCouponsByCodeLength(1)->willReturn(1);
     $this->isGenerationPossible($instruction)->shouldReturn(false);
     $this->getPossibleGenerationAmount($instruction)->shouldReturn(7.0);
 }