Skip to content

Commit

Permalink
Get feature testing working with enforced and enrolled values
Browse files Browse the repository at this point in the history
  • Loading branch information
mtompset committed Jul 25, 2023
1 parent 70557d9 commit 8c34cfc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions SilMock/Google/Service/Directory/UsersResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ public function insert($postBody)
'lastLoginTime' => $currentDateTime->format('c'),
'creationTime' => $currentDateTime->format('c'),
'agreedToTerms' => false,
'isEnforcedIn2Sv' => false,
'isEnrolledIn2Sv' => false,
'isEnforcedIn2Sv' => 'false',
'isEnrolledIn2Sv' => 'false',
);

// array_merge will not work, since $postBody is an object which only
Expand Down Expand Up @@ -242,6 +242,12 @@ public function update($userKey, $postBody)
$dbUserProps[$key] = $value;
}
}
if (!isset($dbUserProps['isEnforcedIn2Sv'])) {
$dbUserProps['isEnforcedIn2Sv'] = 'false';
}
if (!isset($dbUserProps['isEnrolledIn2Sv'])) {
$dbUserProps['isEnrolledIn2Sv'] = 'false';
}

// Delete the user's old aliases before adding the new ones
$usersAliases = new UsersAliasesResource($this->dbFile);
Expand Down Expand Up @@ -404,10 +410,11 @@ private function doesUserMatch($entry, $query = '')
}
if (! is_string($checkValue)) {
throw new \Exception(sprintf(
"Expecting a string.\nGot Entry: %s\nGot Field: %s\nGot VALUE: %s",
"Expecting a string.\nGot Entry: %s\nGot Field: %s\nGot VALUE: %s (%s)",
var_export($entry, true),
var_export($field, true),
var_export($checkValue, true)
var_export($checkValue, true),
gettype($checkValue)
));
}
if (mb_strpos($checkValue, $value) === 0) {
Expand Down

0 comments on commit 8c34cfc

Please sign in to comment.