Exemplo n.º 1
0
    if ($type == 'Private') {
        continue;
    }
    if (!$config['ownedPublicGroupID'] && $type == 'PublicOpen' && $owner == $config['userID'] && $libraryReading == 'all') {
        $config['ownedPublicGroupID'] = $id;
    } else {
        if (!$config['ownedPublicNoAnonymousGroupID'] && $type == 'PublicClosed' && $owner == $config['userID'] && $libraryReading == 'members') {
            $config['ownedPublicNoAnonymousGroupID'] = $id;
        } else {
            $toDelete[] = $id;
        }
    }
}
if (!$config['ownedPublicGroupID']) {
    $config['ownedPublicGroupID'] = API3::createGroup(['owner' => $config['userID'], 'type' => 'PublicOpen', 'libraryReading' => 'all']);
}
if (!$config['ownedPublicNoAnonymousGroupID']) {
    $config['ownedPublicNoAnonymousGroupID'] = API3::createGroup(['owner' => $config['userID'], 'type' => 'PublicClosed', 'libraryReading' => 'members']);
}
foreach ($toDelete as $groupID) {
    API3::deleteGroup($groupID);
}
$config['numOwnedGroups'] = 3;
$config['numPublicGroups'] = 2;
foreach ($groups as $group) {
    API3::groupClear($group['id']);
}
\Zotero\Tests\Config::update($config);
unset($response);
unset($groups);
unset($toDelete);