public function log($msg, $level = "info") { $log = new DBLog(); $log->setAuthor($this->author); $log->setPriority($level); $log->setMessage($msg); $this->em->persist($log); $this->em->flush(); }
public function testPurge() { $purger = new Purger($this->em); for ($i = 0; $i < 111; $i++) { $log = new DBLog(); $log->log("hello"); $this->em->persist($log); } $this->em->flush(); $purger->purge(100); $this->assertEquals(100, $this->em->getRepository("MaallsDBLogBundle:DBLog")->count()); }