Skip to content

Commit

Permalink
GL-1723: Added expires_at mandatory arg for codestudio token.
Browse files Browse the repository at this point in the history
  • Loading branch information
akashkska committed Oct 30, 2023
1 parent 6d5651e commit 515b4a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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 @@ private function createProjectAccessToken(array $project, string $projectAccessT
$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);
$projectAccessToken = $this->gitLabClient->projects()
->createProjectAccessToken($project['id'], [
'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

0 comments on commit 515b4a0

Please sign in to comment.