Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function calculate(ShippingSubjectInterface $subject, array $configuration)
 {
     return (int) ($configuration['fixed'] + round($configuration['variable'] * ($subject->getShippingWeight() / $configuration['division'])));
 }
Exemplo n.º 2
0
 function its_calculated_value_should_be_an_integer(ShippingSubjectInterface $subject)
 {
     $subject->getShippingWeight()->willReturn(10);
     $this->calculate($subject, array('fixed' => 200, 'variable' => 500, 'division' => 1))->shouldBeInteger();
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function calculate(ShippingSubjectInterface $subject, array $configuration)
 {
     return $configuration['amount'] * ($subject->getShippingWeight() / $configuration['division']);
 }