/** * @depends testInsert */ public function testUpdate() { $app = $this->getApp(); $entityName = 'Bolt\\Storage\\Entity\\Users'; $this->runListenCount($app, 'preSave'); $this->runListenCount($app, 'postSave'); $em = new EntityManager($app['db'], $app['dispatcher'], $app['storage.metadata']); $repo = $em->getRepository($entityName); $existing = $repo->findOneBy(['displayname' => 'Test User']); $existing->setUsername('testupdated'); $em->save($existing); $existing2 = $repo->findOneBy(['displayname' => 'Test User']); $this->assertEquals('testupdated', $existing2->getUsername()); $this->assertEquals(1, $this->eventCount['preSave']); $this->assertEquals(1, $this->eventCount['postSave']); }