public function setUp()
 {
     parent::setUp();
     $documentManager = $this->getDocumentManager();
     for ($i = 1; $i <= 20; $i++) {
         $document = new Simple();
         $document->setName("Document {$i}");
         $documentManager->persist($document);
     }
     $documentManager->flush();
 }
 public function setup()
 {
     parent::setup();
     $this->numberOfItems = 20;
     $documentManager = $this->getDocumentManager();
     for ($i = 1; $i <= $this->numberOfItems; $i++) {
         $document = new Simple();
         $document->setName(sprintf('Document %02d', $i));
         $documentManager->persist($document);
     }
     $documentManager->flush();
 }
Ejemplo n.º 3
0
 public function testPersist()
 {
     $documentManager = $this->getDocumentManager();
     $simple = new Simple();
     $simple->setName('lucy');
     $documentManager->persist($simple);
     $documentManager->flush();
     $id = $simple->getId();
     $repository = $documentManager->getRepository(get_class($simple));
     $simple = $repository->find($id);
     $this->assertEquals('lucy', $simple->getName());
 }