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

Add issueStatelessChannelToken test #607

Merged
merged 3 commits into from
Aug 16, 2024

Conversation

eucyt
Copy link
Contributor

@eucyt eucyt commented Aug 15, 2024

/oauth2/v3/token requires only 3 parameters, but client requires 5 parameters. Our client must work even if some of arguments are passed null like client.issueStatelessChannelToken("client_credentials", null, null, "1234", "clientSecret"). This change adds a test to verify this.

@eucyt eucyt self-assigned this Aug 15, 2024
Copy link
Contributor

@Yang-33 Yang-33 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

body: json_encode(['access_token' => 'accessToken', 'expires_in' => 30, 'token_type' => 'Bearer',]),
));
$api = new ChannelAccessTokenApi($client);
$response = $api->issueStatelessChannelToken("client_credentials",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about explicitly using required arguments to work tests even if new optional argument is required?
issueStatelessChannelToken(grantType: "client_credentials", clientId: "1234", clientSecret: "channelSecret")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll do that. In fact, I think that this is also the more common use case for users.

@@ -0,0 +1,59 @@
<?php
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized that since it was a test for a different API class, it should be in a separate test class 🙏

@eucyt eucyt requested a review from Yang-33 August 16, 2024 01:37
Copy link
Contributor

@Yang-33 Yang-33 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@eucyt eucyt merged commit cb52132 into line:master Aug 16, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants