test(php): add phpunit tests for OauthService - #1131
Conversation
Signed-off-by: Saw-jan <saw.jan.grg3e@gmail.com>
| $oauthService = $this->getOauthServiceMock($clientMapperMock); | ||
|
|
||
| $result = $oauthService->setClientRedirectUri(1, $client->getRedirectUri()); | ||
| $this->assertEquals(true, $result); |
There was a problem hiding this comment.
| $this->assertEquals(true, $result); | |
| $this->assertTrue($result); |
| $oauthService = $this->getOauthServiceMock($clientMapperMock); | ||
|
|
||
| $result = $oauthService->setClientRedirectUri(1, $client->getRedirectUri()); | ||
| $this->assertEquals(false, $result); |
There was a problem hiding this comment.
| $this->assertEquals(false, $result); | |
| $this->assertFalse($result); |
| $oauthService = $this->getOauthServiceMock($clientMapperMock); | ||
|
|
||
| $clientInfo = $oauthService->createNcOauthClient($client->getName(), $client->getRedirectUri()); | ||
| $this->assertEquals($expectedClient, $clientInfo); |
There was a problem hiding this comment.
| $this->assertEquals($expectedClient, $clientInfo); | |
| $this->assertSame($expectedClient, $clientInfo); |
There was a problem hiding this comment.
need to do strict assertion 👍
| $client->setClientIdentifier('randomString'); | ||
| $client->setSecret('randomString'); |
There was a problem hiding this comment.
Why are these values the same? Are they supposed to be different?
There was a problem hiding this comment.
because we are mocking random generate method to return randomString.
There was a problem hiding this comment.
but it can be anything here. secrets won't be used in the test
There was a problem hiding this comment.
I was a bit confused because both values are the same.
If the specific values don't matter for this test, could we use different strings instead? It would make it clearer that clientIdentifier and secret are separate values.
There was a problem hiding this comment.
I don't think so, because this a test client for assertion and we are mocking generate method which will always return same.
Description
Add phpunit tests for
OauthServiceclassRelated Issue or Workpackage
Types of changes
Checklist:
CHANGELOG.mdfile