Commit dddfd864 authored by Aron Novak's avatar Aron Novak

og_ui: fix non-existing group test

parent cd2d5182
......@@ -1117,13 +1117,17 @@ function og_ui_get_group_admin($entity_type, $etid) {
}
// ensure we are invoking this on something worth doing it on
$entity = entity_load_single($entity_type, $etid);
if (!$entity) {
// It is a non-existing group Id, giving up.
return FALSE;
}
$entity_info = entity_get_info($entity_type);
// if this isn't a group type, skip invoking admin modules
if (empty($entity_info['entity keys']['bundle']) || !og_is_group_type($entity_type, $entity->{$entity_info['entity keys']['bundle']})) {
$cache["$entity_type:$etid"] = FALSE;
return FALSE;
}
$data = module_invoke_all('og_ui_get_group_admin', $entity_type, $etid);
......
......@@ -435,8 +435,12 @@ class OgUiManagePeopleTestCase extends DrupalWebTestCase {
$this->drupalGet('entity_test/0x' . $this->entity->pid . '/group');
$this->assertResponse(403);
// Non-existing groups return 404 however.
$this->drupalGet('entity_test/666/group');
$this->drupalGet('entity_test/666');
$this->assertResponse(404);
// For the same, admin area returns 403.
$this->drupalGet('entity_test/666/group');
$this->assertResponse(403);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment