예제 #1
0
 public function testToString()
 {
     $entity = new PaymentTerm();
     $this->assertEmpty((string) $entity);
     $entity->setLabel('test');
     $this->assertEquals('test', (string) $entity);
 }
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $paymentTerm = new PaymentTerm();
     $paymentTerm->setLabel('net 10');
     $manager->persist($paymentTerm);
     $manager->flush();
     $this->addReference(self::PAYMENT_TERM_NET_10, $paymentTerm);
 }
 /**
  * @return array
  */
 public function buildFormDataProvider()
 {
     $accountWithGroup = $this->createAccountEntity();
     $accountWithGroup->setGroup($this->createAccountGroupEntity());
     $account = $this->createAccountEntity();
     $paymentTerm = new PaymentTerm();
     $paymentTerm->setLabel('Payment term label');
     return ['with group and payment term' => ['options' => ['label' => 'orob2b.payment.paymentterm.entity_label', 'required' => false, 'mapped' => false, 'configs' => ['placeholder' => 'orob2b.payment.account.payment_term_defined_in_group_trans']], 'account' => $accountWithGroup, 'byAccountGroup' => true, 'paymentTerm' => $paymentTerm], 'with group and empty payment term' => ['options' => ['label' => 'orob2b.payment.paymentterm.entity_label', 'required' => false, 'mapped' => false, 'configs' => ['placeholder' => 'orob2b.payment.account.payment_term_non_defined_in_group_trans']], 'account' => $accountWithGroup, 'byAccountGroup' => true], 'without group' => ['options' => ['label' => 'orob2b.payment.paymentterm.entity_label', 'required' => false, 'mapped' => false], 'account' => $account, 'byAccountGroup' => false]];
 }
 /**
  * @dataProvider submitDataProvider
  * @param array $submittedData
  */
 public function testSubmit(array $submittedData)
 {
     $form = $this->factory->create($this->formType, $this->newPaymentTerm);
     $form->submit($submittedData);
     $this->assertTrue($form->isValid());
     $expected = new PaymentTerm();
     $expected->setLabel($submittedData['label']);
     $this->assertEquals($expected, $form->getData());
 }
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $paymentTermsLabels = ['net 10', 'net 15', 'net 30', 'net 60'];
     foreach ($paymentTermsLabels as $paymentTermLabel) {
         $paymentTerm = new PaymentTerm();
         $paymentTerm->setLabel($paymentTermLabel);
         $manager->persist($paymentTerm);
     }
     $manager->flush();
 }
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $paymentTermsLabels = [self::TERM_LABEL_NET_10, self::TERM_LABEL_NET_20, self::TERM_LABEL_NET_30];
     foreach ($paymentTermsLabels as $paymentTermLabel) {
         $paymentTerm = new PaymentTerm();
         $paymentTerm->setLabel($paymentTermLabel);
         $manager->persist($paymentTerm);
     }
     $manager->flush();
 }
 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     foreach ($this->data as $paymentTermData) {
         $paymentTerm = new PaymentTerm();
         $paymentTerm->setLabel($paymentTermData['label']);
         foreach ($paymentTermData['groups'] as $groupName) {
             $paymentTerm->addAccountGroup($this->getReference($groupName));
         }
         foreach ($paymentTermData['accounts'] as $accountName) {
             $paymentTerm->addAccount($this->getReference($accountName));
         }
         $manager->persist($paymentTerm);
         $this->addReference(static::PAYMENT_TERM_REFERENCE_PREFIX . $paymentTermData['label'], $paymentTerm);
     }
     $manager->flush();
 }