Exemple #1
0
 public function testEntityRequiresNonEmptyName()
 {
     $entity = new Unit();
     $entity->translate('en')->setName('');
     $entity->mergeNewTranslations();
     $errors = $this->validator->validate($entity);
     $this->assertEquals(1, count($errors));
 }
Exemple #2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     foreach (self::$samples as $name) {
         $unit = new Unit();
         $unit->translate('en')->setName($name);
         $unit->mergeNewTranslations();
         $manager->persist($unit);
         $this->setReference('unit_' . $name, $unit);
     }
     $manager->flush();
 }
Exemple #3
0
 /**
  * @return \WellCommerce\AppBundle\Entity\UnitInterface
  */
 public function create()
 {
     $unit = new Unit();
     $unit->setCreatedAt(new \DateTime());
     return $unit;
 }