/**
  * @dataProvider getPaymentTermDataProvider
  *
  * @param Account $account
  * @param array $repositoryMethods
  * @param PaymentTerm|null $expected
  */
 public function testGetPaymentTerm(Account $account, array $repositoryMethods, PaymentTerm $expected = null)
 {
     $repository = $this->assertPaymentTermRepositoryCall();
     foreach ($repositoryMethods as $methodName => $methodParams) {
         $invocationMocker = $repository->expects($methodParams['expects'])->method($methodName);
         if (array_key_exists('willReturn', $methodParams)) {
             $invocationMocker->with($methodParams['with'])->willReturn($methodParams['willReturn']);
         }
     }
     $this->assertEquals($expected, $this->provider->getPaymentTerm($account));
 }
Ejemplo n.º 2
0
 /**
  * @param Order $order
  * @return int|null
  */
 protected function getAccountGroupPaymentTermId(Order $order)
 {
     $account = $order->getAccount();
     if (!$account || !$account->getGroup()) {
         return null;
     }
     $paymentTerm = $this->paymentTermProvider->getAccountGroupPaymentTerm($account->getGroup());
     return $paymentTerm ? $paymentTerm->getId() : null;
 }