Example #1
0
 /**
  * @return \WellCommerce\AppBundle\Entity\TaxInterface
  */
 public function create()
 {
     $tax = new Tax();
     $tax->setValue(0);
     $tax->setCreatedAt(new \DateTime());
     return $tax;
 }
Example #2
0
 public function testValidationFailsIfWrongValue()
 {
     $entity = new Tax();
     $entity->setValue(-10);
     $entity->translate('en')->setName('Test');
     $entity->mergeNewTranslations();
     $errors = $this->validator->validate($entity);
     $this->assertEquals(1, count($errors));
 }
Example #3
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     foreach (self::$samples as $val) {
         $name = sprintf('%s%s', $val, '%');
         $tax = new Tax();
         $tax->setValue($val);
         $tax->translate('en')->setName($name . ' VAT');
         $tax->mergeNewTranslations();
         $manager->persist($tax);
         $this->setReference('tax_' . $val, $tax);
     }
     $manager->flush();
 }