Esempio n. 1
0
 protected function createAuthors($count)
 {
     for ($i = 0; $i < $count; ++$i) {
         $author = new Author();
         $author->setName("Name{$i}");
         $this->entityManager()->persist($author);
     }
     $this->entityManager()->flush();
 }
Esempio n. 2
0
 protected function createPosts($count)
 {
     $author = new Author();
     $author->setName('Author');
     $this->entityManager()->persist($author);
     $this->entityManager()->flush();
     for ($i = 0; $i < $count; ++$i) {
         $post = new Post();
         $post->setTitle('Title' . $i);
         $post->setContent('Content' . $i);
         $post->setAuthor($author);
         $this->entityManager()->persist($post);
     }
     $this->entityManager()->flush();
 }
Esempio n. 3
0
 public function testSubmitValidData()
 {
     $formData = array('name' => 'test');
     $type = new AuthorType();
     $form = $this->factory->create($type);
     $object = new Author();
     $object->setName('test');
     $form->submit($formData);
     $this->assertTrue($form->isSynchronized());
     $this->assertEquals($formData, $form->getData());
     $view = $form->createView();
     $children = $view->children;
     foreach (array_keys($formData) as $key) {
         $this->assertArrayHasKey($key, $children);
     }
 }
Esempio n. 4
0
 /**
  * @return Author
  */
 protected function createAuthor()
 {
     $author = new Author();
     $author->setName('Author');
     $this->entityManager()->persist($author);
     $this->entityManager()->flush();
     return $author;
 }