示例#1
0
 /**
  * {@inheritdoc}
  */
 public function calculate(ShippingSubjectInterface $subject, array $configuration)
 {
     return (int) ($configuration['fixed'] + round($configuration['variable'] * ($subject->getShippingWeight() / $configuration['division'])));
 }
 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();
 }
示例#3
0
 /**
  * {@inheritdoc}
  */
 public function calculate(ShippingSubjectInterface $subject, array $configuration)
 {
     return $configuration['amount'] * ($subject->getShippingWeight() / $configuration['division']);
 }