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 = TimeZoneTest::createTestTimeZone(); self::$entityManager->persist($testEntity); self::$entityManager->flush(); $this->assertNotEquals('fubar', $testEntity->getName()); $testEntity->setName('fubar'); TimeZoneService::update(); $entities = self::$entityManager->createQuery('SELECT e FROM Rexmac\\Zyndax\\Entity\\TimeZone e')->execute(); $this->assertEquals('fubar', $entities[0]->getName()); }