本文整理汇总了PHP中ElggGroup::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggGroup::delete方法的具体用法?PHP ElggGroup::delete怎么用?PHP ElggGroup::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElggGroup
的用法示例。
在下文中一共展示了ElggGroup::delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSqlAdditionalSelectsAsVolatileDataWithCache
/**
* Checks if additional select columns are readable as volatile data even if we hit the cache while fetching entity.
*
* https://github.com/Elgg/Elgg/issues/5544
*/
public function testSqlAdditionalSelectsAsVolatileDataWithCache()
{
// remove ignore access as it disables entity cache
$access = elgg_set_ignore_access(false);
// may not have groups in DB - let's create one
$group = new ElggGroup();
$group->name = 'test_group';
$group->access_id = ACCESS_PUBLIC;
$this->assertTrue($group->save() !== false);
foreach (array('site', 'user', 'group', 'object') as $type) {
$entities = elgg_get_entities(array('type' => $type, 'selects' => array('42 as added_col3'), 'limit' => 1));
$entity = array_shift($entities);
$this->assertTrue($entity instanceof ElggEntity);
$this->assertEqual($entity->added_col3, null, "Additional select columns are leaking to attributes for " . get_class($entity));
$this->assertEqual($entity->getVolatileData('select:added_col3'), 42);
// make sure we have cached the entity
$this->assertNotEqual(false, _elgg_retrieve_cached_entity($entity->guid));
}
// run these again but with different value to make sure cache does not interfere
foreach (array('site', 'user', 'group', 'object') as $type) {
$entities = elgg_get_entities(array('type' => $type, 'selects' => array('64 as added_col3'), 'limit' => 1));
$entity = array_shift($entities);
$this->assertTrue($entity instanceof ElggEntity);
$this->assertEqual($entity->added_col3, null, "Additional select columns are leaking to attributes for " . get_class($entity));
$this->assertEqual($entity->getVolatileData('select:added_col3'), 64, "Failed to overwrite volatile data in cached entity");
}
elgg_set_ignore_access($access);
$group->delete();
}
示例2: test_disabling_annotations_infinite_loop
/**
* Ensure that \ElggBatch doesn't go into infinite loop when disabling annotations recursively when show hidden is enabled.
*
* https://github.com/Elgg/Elgg/issues/5952
*/
public function test_disabling_annotations_infinite_loop()
{
//let's have some entity
$group = new \ElggGroup();
$group->name = 'test_group';
$group->access_id = ACCESS_PUBLIC;
$this->assertTrue($group->save() !== false);
$total = 51;
//add some annotations
for ($cnt = 0; $cnt < $total; $cnt++) {
$group->annotate('test_annotation', 'value_' . $total);
}
//disable them
$show_hidden = access_get_show_hidden_status();
access_show_hidden_entities(true);
$options = array('guid' => $group->guid, 'limit' => $total);
elgg_disable_annotations($options);
access_show_hidden_entities($show_hidden);
//confirm all being disabled
$annotations = $group->getAnnotations(array('limit' => $total));
foreach ($annotations as $annotation) {
$this->assertTrue($annotation->enabled == 'no');
}
//delete group and annotations
$group->delete();
}
示例3: ElggUser
function test_can_write_to_container()
{
$user = new ElggUser();
$user->username = 'test_user_' . rand();
$user->name = 'test_user_name_' . rand();
$user->email = 'test@user.net';
$user->container_guid = 0;
$user->owner_guid = 0;
$user->save();
$object = new ElggObject();
$object->save();
$group = new ElggGroup();
$group->save();
// disable access overrides because we're admin.
$ia = elgg_set_ignore_access(false);
$this->assertFalse(can_write_to_container($user->guid, $object->guid));
global $elgg_test_user;
$elgg_test_user = $user;
// register hook to allow access
function can_write_to_container_test_hook($hook, $type, $value, $params)
{
global $elgg_test_user;
if ($params['user']->getGUID() == $elgg_test_user->getGUID()) {
return true;
}
}
elgg_register_plugin_hook_handler('container_permissions_check', 'all', 'can_write_to_container_test_hook');
$this->assertTrue(can_write_to_container($user->guid, $object->guid));
elgg_unregister_plugin_hook_handler('container_permissions_check', 'all', 'can_write_to_container_test_hook');
$this->assertFalse(can_write_to_container($user->guid, $group->guid));
$group->join($user);
$this->assertTrue(can_write_to_container($user->guid, $group->guid));
elgg_set_ignore_access($ia);
$user->delete();
$object->delete();
$group->delete();
}
示例4: testJoinLeaveGroupACL
public function testJoinLeaveGroupACL()
{
if (!elgg_is_active_plugin('groups')) {
return;
}
$group = new ElggGroup();
$group->name = 'Test group';
$group->save();
$result = $group->join($this->user);
$this->assertTrue($result);
// disable security since we run as admin
$ia = elgg_set_ignore_access(false);
// need to set the page owner to emulate being in a group context.
// this is kinda hacky.
elgg_set_page_owner_guid($group->getGUID());
if ($result) {
$can_edit = can_edit_access_collection($group->group_acl, $this->user->guid);
$this->assertTrue($can_edit);
}
$result = $group->leave($this->user);
$this->assertTrue($result);
if ($result) {
$can_edit = can_edit_access_collection($group->group_acl, $this->user->guid);
$this->assertFalse($can_edit);
}
elgg_set_ignore_access($ia);
$group->delete();
}
示例5: test_extra_columns_dont_appear_in_attributes
/**
* Ensure additional select columns do not end up in entity attributes.
*
* https://github.com/Elgg/Elgg/issues/5538
*/
public function test_extra_columns_dont_appear_in_attributes()
{
global $ENTITY_CACHE;
// may not have groups in DB - let's create one
$group = new ElggGroup();
$group->name = 'test_group';
$group->access_id = ACCESS_PUBLIC;
$this->assertTrue($group->save() !== false);
// entity cache interferes with our test
$ENTITY_CACHE = array();
foreach (array('site', 'user', 'group', 'object') as $type) {
$entities = elgg_get_entities(array('type' => $type, 'selects' => array('1 as _nonexistent_test_column'), 'limit' => 1));
if (!$this->assertTrue($entities, "Query for '{$type}' did not return an entity.")) {
continue;
}
$entity = $entities[0];
$this->assertNull($entity->_nonexistent_test_column, "Additional select columns are leaking to attributes for '{$type}'");
}
$group->delete();
}
示例6: tearDown
/**
* Called after each test method.
*/
public function tearDown()
{
$this->group->delete();
$this->user->delete();
}