本文整理汇总了PHP中Documents\User::setPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setPassword方法的具体用法?PHP User::setPassword怎么用?PHP User::setPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Documents\User
的用法示例。
在下文中一共展示了User::setPassword方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDetach
public function testDetach()
{
$user = new User();
$user->setUsername('jon');
$user->setPassword('changeme');
$this->dm->persist($user);
$this->dm->flush();
$user->setUsername('whoop');
$this->dm->detach($user);
$this->dm->flush();
$this->dm->clear();
$user2 = $this->dm->find('Documents\\User', $user->getId());
$this->assertEquals('jon', $user2->getUsername());
}
示例2: testRemove
public function testRemove()
{
$account = new Account();
$account->setName('Jon Test Account');
$user = new User();
$user->setUsername('jon');
$user->setPassword('changeme');
$user->setAccount($account);
$this->dm->persist($user);
$this->dm->flush();
$this->dm->remove($user);
$this->dm->flush();
$account = $this->dm->find('Documents\\Account', $account->getId());
$this->assertNull($account);
$user = $this->dm->find('Documents\\User', $user->getId());
$this->assertNull($user);
}
示例3: testReplaceEntireGroupsArray
public function testReplaceEntireGroupsArray()
{
$account = new Account();
$account->setName('Jon Test Account');
$user = new User();
$user->setUsername('jon333');
$user->setPassword('changeme');
$user->setAccount($account);
$group2 = new Group('member');
$user->addGroup(new Group('administrator'));
$user->addGroup($group2);
$user->addGroup(new Group('moderator'));
$this->dm->persist($user);
$this->dm->flush();
$this->dm->clear();
$user = $this->dm->find('Documents\\User', $user->getId());
$this->assertNotNull($user);
// Issue is collection must be initialized
$groups = $user->getGroups();
$groups[0];
// initialize collection
// reffectively remove two of the groups
//$user->getGroups()->clear();
//$user->getGroups()->add($group2);
$user->setGroups(array($group2));
$this->assertEquals(1, count($user->getGroups()));
$this->dm->flush();
$this->dm->clear();
$user = $this->dm->find('Documents\\User', $user->getId());
$this->assertEquals(1, count($user->getGroups()));
}
示例4: testReplaceGroups
public function testReplaceGroups()
{
$this->dm->getUnitOfWork()->setDocumentPersister('Documents\\User', new BasicDocumentPersister($this->dm, $this->classMetadata));
$account = new Account();
$account->setName('Jon Test Account');
$user = new User();
$user->setUsername('jon');
$user->setPassword('changeme');
$user->setAccount($account);
$user->addGroup(new Group('administrator'));
$user->addGroup(new Group('member'));
$user->addGroup(new Group('moderator'));
$this->dm->persist($user);
$this->dm->flush();
$this->dm->clear();
unset($user, $account);
$user = $this->dm->findOne('Documents\\User');
$user->removeGroup('moderator');
$user->removeGroup('member');
$this->assertEquals(1, count($user->getGroups()));
$user->addGroup(new Group('seller'));
$user->addGroup(new Group('supplier'));
$this->assertEquals(3, count($user->getGroups()));
$this->dm->getUnitOfWork()->setDocumentPersister('Documents\\User', $this->persister);
$this->persister->expects($this->once())->method('update')->with($user);
$this->dm->getUnitOfWork()->computeChangeSets();
$update = $this->persister->prepareUpdateData($user);
$this->assertFalse(array_key_exists('$set', $update));
$this->assertFalse(array_key_exists('$unset', $update));
$this->assertTrue(array_key_exists('$pullAll', $update));
$this->assertTrue(array_key_exists('groups', $update['$pullAll']));
$this->assertEquals(2, count($update['$pullAll']['groups']));
$this->assertTrue(array_key_exists('$pushAll', $update));
$this->assertTrue(array_key_exists('groups', $update['$pushAll']));
$this->assertEquals(2, count($update['$pushAll']['groups']));
$this->dm->flush();
$this->dm->clear();
unset($user);
$user = $this->dm->findOne('Documents\\User');
$this->assertEquals(3, count($user->getGroups()));
}
示例5: testFindUser
public function testFindUser()
{
$account = new Account();
$account->setName('Jon Test Account');
$user1 = new CustomUser();
$user1->setId('userId');
$user1->setUsername('user1');
$user1->setPassword('changeme');
$user1->setAccount($account);
$user2 = new User();
$user2->setUsername('user2');
$user2->setPassword('changeme');
$user2->setAccount($account);
$user3 = new User();
$user3->setUsername('user3');
$user3->setPassword('changeme');
$user3->setAccount($account);
$this->dm->persist($user1);
$this->dm->persist($user2);
$this->dm->persist($user3);
$this->dm->flush();
$this->dm->clear();
unset($user1, $user2, $user3);
$user = $this->dm->find('Documents\\CustomUser', 'userId');
$this->assertNotNull($user);
$this->assertEquals('userId', $user->getId());
$this->assertEquals('user1', $user->getUsername());
$this->dm->clear();
unset($user);
$this->assertNull($this->dm->find('Documents\\User', 'userId'));
$this->assertNull($this->dm->find('Documents\\CustomUser', 'asd'));
}
示例6: Configuration
$classLoader->register();
$config = new Configuration();
/*
$config->setLoggerCallable(function(array $log) {
print_r($log);
});
$config->setMetadataCacheImpl(new ApcCache());
*/
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Proxies');
$reader = new AnnotationReader();
$reader->setDefaultAnnotationNamespace('Doctrine\\ODM\\MongoDB\\Mapping\\');
$config->setMetadataDriverImpl(new AnnotationDriver($reader, __DIR__ . '/Documents'));
//$config->setMetadataDriverImpl(new XmlDriver(__DIR__ . '/xml'));
//$config->setMetadataDriverImpl(new YamlDriver(__DIR__ . '/yaml'));
//$config->setMetadataDriverImpl(new PHPDriver());
$dm = DocumentManager::create(new Mongo(), $config);
$profile = new Profile();
$profile->setName('Jonathan H. Wage');
$profile->addSong(new Song('Testinfuckckcg'));
$user = new User();
$user->setUsername('jwage');
$user->setPassword('changeme');
$user->addPhonenumber(new Phonenumber('6155139185'));
$user->setProfile($profile);
$configuration = new ConfigurationDoc();
$configuration->setTimezone('Eastern');
$configuration->setTheme('doctrine');
$user->setConfiguration($configuration);
$dm->persist($user);
$dm->flush();
示例7: setPassword
public function setPassword($value)
{
$this->__load();
return parent::setPassword($value);
}