本文整理汇总了PHP中ElggUser::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggUser::delete方法的具体用法?PHP ElggUser::delete怎么用?PHP ElggUser::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElggUser
的用法示例。
在下文中一共展示了ElggUser::delete方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
elgg_unregister_notification_method('test');
$this->user1->delete();
$this->user2->delete();
$this->group->delete();
}
示例2: testCanEdit
public function testCanEdit()
{
$user = new \ElggUser();
$user->save();
$id = $this->entity->annotate('test', 'foo', ACCESS_LOGGED_IN, elgg_get_logged_in_user_guid());
$a = elgg_get_annotation_from_id($id);
$this->assertTrue($a->canEdit());
$this->assertFalse($a->canEdit($user->guid));
$id = $this->entity->annotate('test', 'foo2', ACCESS_LOGGED_IN, $user->guid);
$a = elgg_get_annotation_from_id($id);
$this->assertTrue($a->canEdit());
$this->assertTrue($a->canEdit($user->guid));
$user->delete();
}
示例3: __destruct
/**
* Called after each test object.
*/
public function __destruct()
{
$this->user->delete();
// all __destruct() code should go above here
parent::__destruct();
}
示例4: test_elgg_metadata_multiple_values
public function test_elgg_metadata_multiple_values()
{
$u1 = new ElggUser();
$u1->username = rand();
$u1->save();
$u2 = new ElggUser();
$u2->username = rand();
$u2->save();
$obj = new ElggObject();
$obj->owner_guid = $u1->guid;
$obj->container_guid = $u1->guid;
$obj->access_id = ACCESS_PUBLIC;
$obj->save();
$md_values = array('one', 'two', 'three');
// need to fake different logins.
// good times without mocking.
$original_user = elgg_get_logged_in_user_entity();
$_SESSION['user'] = $u1;
elgg_set_ignore_access(false);
// add metadata as one user
$obj->test = $md_values;
// check only these md exists
$db_prefix = elgg_get_config('dbprefix');
$q = "SELECT * FROM {$db_prefix}metadata WHERE entity_guid = {$obj->guid}";
$data = get_data($q);
$this->assertEqual(count($md_values), count($data));
foreach ($data as $md_row) {
$md = elgg_get_metadata_from_id($md_row->id);
$this->assertTrue(in_array($md->value, $md_values));
$this->assertEqual('test', $md->name);
}
// add md w/ same name as a different user
$_SESSION['user'] = $u2;
$md_values2 = array('four', 'five', 'six', 'seven');
$obj->test = $md_values2;
$q = "SELECT * FROM {$db_prefix}metadata WHERE entity_guid = {$obj->guid}";
$data = get_data($q);
$this->assertEqual(count($md_values2), count($data));
foreach ($data as $md_row) {
$md = elgg_get_metadata_from_id($md_row->id);
$this->assertTrue(in_array($md->value, $md_values2));
$this->assertEqual('test', $md->name);
}
$_SESSION['user'] = $original_user;
$obj->delete();
$u1->delete();
$u2->delete();
}
示例5: testCreateWithContainerGuidEqualsZero
public function testCreateWithContainerGuidEqualsZero()
{
$user = new \ElggUser();
$user->save();
$object = new \ElggObject();
$object->owner_guid = $user->guid;
$object->container_guid = 0;
// If container_guid attribute is not updated with owner_guid attribute
// ElggEntity::getContainerEntity() would return false
// thus terminating save()
$this->assertTrue($object->save());
$this->assertEqual($user->guid, $object->getContainerGUID());
$user->delete();
}
示例6: testAccessCaching
public function testAccessCaching()
{
// create a new user to check against
$user = new ElggUser();
$user->username = 'access_test_user';
$user->save();
foreach (array('get_access_list', 'get_access_array') as $func) {
$cache = _elgg_get_access_cache();
$cache->clear();
// admin users run tests, so disable access
elgg_set_ignore_access(true);
$access = $func($user->getGUID());
elgg_set_ignore_access(false);
$access2 = $func($user->getGUID());
$this->assertNotEqual($access, $access2, "Access test for {$func}");
}
$user->delete();
}
示例7: testElggRiverDisableEnable
public function testElggRiverDisableEnable()
{
$user = new \ElggUser();
$user->save();
$entity = new \ElggObject();
$entity->save();
$params = array('view' => 'river/relationship/friend/create', 'action_type' => 'create', 'subject_guid' => $user->guid, 'object_guid' => $entity->guid);
$id = elgg_create_river_item($params);
$river = elgg_get_river(array('ids' => array($id)));
$this->assertIdentical($river[0]->enabled, 'yes');
$user->disable();
// should no longer be able to get the river
$river = elgg_get_river(array('ids' => array($id)));
$this->assertIdentical($river, array());
// renabling the user should re-enable the river
access_show_hidden_entities(true);
$user->enable();
access_show_hidden_entities(false);
$river = elgg_get_river(array('ids' => array($id)));
$this->assertIdentical($river[0]->enabled, 'yes');
$user->delete();
$entity->delete();
}
示例8: testAddMemberToACLRemoveMember
public function testAddMemberToACLRemoveMember()
{
// create a new user to check against
$user = new \ElggUser();
$user->username = 'access_test_user';
$user->save();
$acl_id = create_access_collection('test acl');
$result = add_user_to_access_collection($user->guid, $acl_id);
$this->assertTrue($result);
if ($result) {
$this->assertTrue($user->delete());
// since there are no more members this should return false
$acl_members = get_members_of_access_collection($acl_id, true);
$this->assertFalse($acl_members);
}
delete_access_collection($acl_id);
}
示例9: tearDown
/**
* Called after each test method.
*/
public function tearDown()
{
$this->group->delete();
$this->user->delete();
}
示例10: rand
/**
* Tests get_entity_statistics() with an owner
* @covers get_entity_statistics()
*/
function test_owned_get_entity_statistics()
{
$user = new \ElggUser();
$user->save();
$subtype = 'issue7845' . rand(0, 100);
$object = new \ElggObject();
$object->subtype = $subtype;
$object->owner_guid = $user->guid;
$object->save();
$stats = get_entity_statistics($user->guid);
$this->assertEqual($stats['object'][$subtype], 1);
$user->delete();
}