function it_should_update_entity(ManagerRegistry $registry, EntityManager $em, ObjectRepository $repo, ClassMetadataInfo $class)
 {
     $entity = (object) ['id' => 1, 'foo' => 1, 'bar' => 2];
     $class->getFieldNames()->willReturn(['id', 'foo', 'bar']);
     $class->getAssociationNames()->willReturn([]);
     $class->setFieldValue($entity, 'foo', 1)->shouldBeCalled();
     $class->setFieldValue($entity, 'bar', 2)->shouldBeCalled();
     $em->persist($entity)->shouldBeCalled();
     $em->flush()->shouldBeCalled();
     $em->getClassMetadata('foo')->willReturn($class);
     $registry->getManager(null)->willReturn($em);
     $em->getRepository('foo')->willReturn($repo);
     $repo->find(1)->willReturn($entity);
     $this->setRegistry($registry);
     $this->update(1, ['foo' => 1, 'bar' => 2])->shouldBeKindaSame((object) ['id' => 1, 'foo' => 1, 'bar' => 2]);
 }