Level 53
I'd say write integration tests for that. Codeception or PHPUnit with the Integrated package would be a good choice. The newest series is about how to use the package.
1 like
Hey guys
What would be the best testing lib and approach to testing DB related methods. Example,
$count = 0;
foreach($create as $userPermission)
{
$spaceUser = SpaceUser::where('id', '=', $userPermission->target_user_id)->first();
$granted = $this->userPermissionEloquent->hasAnyUserPermissions($space, $spaceUser);
if($granted === true )
{
$isVerify[] = $granted;
$count++;
}
}
$overall['verified'] = [$count, count($isVerify)];
$count = 0;
foreach($create as $userPermission)
{
$spaceUser = SpaceUser::where('id', '=', $userPermission->target_user_id)->first();
$container = Container::find($userPermission->target_object_id);
$granted = $this->userPermissionEloquent->permissionsGranted($space, $spaceUser, $container);
$firstGranted = $granted->first();
if ($firstGranted instanceof UserPermission)
{
$find[] = $granted;
$count++;
}
}
$overall['found'] = [$count, count($find)];
I'd say write integration tests for that. Codeception or PHPUnit with the Integrated package would be a good choice. The newest series is about how to use the package.
Please or to participate in this conversation.