Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GL-1723: Added expires_at mandatory arg for codestudio token. #1617

Merged
merged 7 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Command/CodeStudio/CodeStudioWizardCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,13 @@
$this->checklist->completePreviousItem();
}
$this->checklist->addItem("Creating access token named <comment>$projectAccessTokenName</comment>");
$d = new \DateTime('tomorrow');
$formattedDate = $d->format('Y-m-d\TH:i:s\Z');
$format = "Y-m-d\TH:i:s\Z";
$dateTime = \DateTime::createFromFormat($format, $formattedDate);
danepowell marked this conversation as resolved.
Show resolved Hide resolved
$projectAccessToken = $this->gitLabClient->projects()
->createProjectAccessToken($project['id'], [

Check warning on line 169 in src/Command/CodeStudio/CodeStudioWizardCommand.php

View workflow job for this annotation

GitHub Actions / Mutation Testing

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ $formattedDate = $d->format('Y-m-d\\TH:i:s\\Z'); $format = "Y-m-d\\TH:i:s\\Z"; $dateTime = \DateTime::createFromFormat($format, $formattedDate); - $projectAccessToken = $this->gitLabClient->projects()->createProjectAccessToken($project['id'], ['expires_at' => $dateTime, 'name' => $projectAccessTokenName, 'scopes' => ['api', 'write_repository']]); + $projectAccessToken = $this->gitLabClient->projects()->createProjectAccessToken($project['id'], ['name' => $projectAccessTokenName, 'scopes' => ['api', 'write_repository']]); $this->checklist->completePreviousItem(); return $projectAccessToken['token']; }
'expires_at' => $dateTime,
'name' => $projectAccessTokenName,
'scopes' => ['api', 'write_repository'],
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,16 @@ public function testMissingGitLabCredentials(): void {
}

protected function mockGitLabProjectsTokens(ObjectProphecy $projects): void {
$d = new \DateTime('tomorrow');
$formattedDate = $d->format('Y-m-d\TH:i:s\Z');
$format = "Y-m-d\TH:i:s\Z";
$dateTime = \DateTime::createFromFormat($format, $formattedDate);
$tokens = [
0 => [
'access_level' => 40,
'active' => TRUE,
'created_at' => '2021-12-28T20:08:21.629Z',
'expires_at' => NULL,
'expires_at' => $dateTime,
'id' => $this->gitLabTokenId,
'name' => 'acquia-codestudio',
'revoked' => FALSE,
Expand Down
Loading