public function testSerializer()
 {
     $user = new User();
     $user->setUsername('superdweebie');
     $user->setPassword('secret');
     //uses Serialize Ignore annotation
     $user->defineLocation('here');
     $user->addGroup(new Group('groupA'));
     $user->addGroup(new Group('groupB'));
     $user->setProfile(new Profile('Tim', 'Roediger'));
     $correct = array('username' => 'superdweebie', 'location' => 'here', 'groups' => array(array('name' => 'groupA'), array('name' => 'groupB')), 'profile' => array('firstname' => 'Tim', 'lastname' => 'Roediger'));
     $array = $this->serializer->toArray($user);
     $this->assertEquals($correct, $array);
 }
 public function testUnserializeUpdate()
 {
     $documentManager = $this->documentManager;
     $user = new User();
     $user->setUsername('superdweebie');
     $user->setPassword('secret');
     //uses Serialize Ignore annotation
     $user->defineLocation('here');
     $user->addGroup(new Group('groupA'));
     $user->addGroup(new Group('groupB'));
     $user->setProfile(new Profile('Tim', 'Roediger'));
     $documentManager->persist($user);
     $documentManager->flush();
     $id = $user->getId();
     $documentManager->clear();
     $updated = $this->serializer->fromArray(['_className' => 'Sds\\DoctrineExtensions\\Test\\Serializer\\TestAsset\\Document\\User', 'id' => $id, 'location' => 'there'], null, Serializer::UNSERIALIZE_UPDATE);
     $this->assertEquals('there', $updated->location());
     $this->assertEquals(null, $updated->getUsername());
     $this->assertEquals(null, $updated->getProfile());
 }