/** * Load user fixtures for a specified scope * * @param TBGScope $scope * @param TBGGroup $admin_group * @param TBGGroup $user_group * @param TBGGroup $guest_group */ public static function loadFixtures(TBGScope $scope, TBGGroup $admin_group, TBGGroup $user_group, TBGGroup $guest_group) { $adminuser = new TBGUser(); $adminuser->setUsername('administrator'); $adminuser->setRealname('Administrator'); $adminuser->setBuddyname('Admin'); $adminuser->setGroup($admin_group); $adminuser->setPassword('admin'); $adminuser->setActivated(); $adminuser->setEnabled(); $adminuser->setAvatar('admin'); $adminuser->setScope($scope); $adminuser->save(); $guestuser = new TBGUser(); $guestuser->setUsername('guest'); $guestuser->setRealname('Guest user'); $guestuser->setBuddyname('Guest user'); $guestuser->setGroup($guest_group); $guestuser->setPassword('password'); // Settings not active yet $guestuser->setActivated(); $guestuser->setEnabled(); $guestuser->setScope($scope); $guestuser->save(); TBGSettings::saveSetting('defaultuserid', $guestuser->getID(), 'core', $scope->getID()); }