Пример #1
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));
 }
Пример #2
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();
 }