public function testFormAlias() { $formData = array('tabs' => array('general' => array('alias' => 'testAlias'))); $form = $this->factory->create(AliasFormType::class, new Alias()); // submit the data to the form directly $form->submit($formData); $this->assertTrue($form->isSynchronized()); $alias = new Alias(); $alias->setAlias('testAlias'); $this->assertEquals($alias, $form->getData()); }
/** * @param Alias $alias * @param LifecycleEventArgs $args * * @return bool */ private function validateUnique(Alias $alias, LifecycleEventArgs $args) { return (bool) $args->getObjectManager()->getRepository('ClasticAliasBundle:Alias')->findBy(array('alias' => $alias->getAlias())); }