Ejemplo n.º 1
0
 public static function createRandomTestUserProfile(User $user = null)
 {
     $testData = self::$testData;
     unset($testData['id']);
     $testData['user'] = null === $user ? UserTest::createRandomTestUser() : $user;
     $testData['firstName'] .= substr(sha1(mt_rand()), 0, 4);
     $testData['lastName'] .= substr(sha1(mt_rand()), 0, 4);
     $testData['socialNetworkIdentities'] = new ArrayCollection(array(UserSocialNetworkIdentityTest::createTestIdentity()));
     $testData['timeZone'] = TimeZoneTest::createRandomTestTimeZone();
     return new UserProfile($testData);
 }
 public function testUpdate()
 {
     $testEntity = UserSocialNetworkIdentityTest::createTestIdentity();
     self::$entityManager->persist($testEntity);
     self::$entityManager->flush();
     $this->assertNotEquals('fubar', $testEntity->getName());
     $testEntity->setName('fubar');
     UserSocialNetworkIdentityService::update();
     $entities = self::$entityManager->createQuery('SELECT e FROM Rexmac\\Zyndax\\Entity\\UserSocialNetworkIdentity e')->execute();
     $this->assertEquals('fubar', $entities[0]->getName());
 }