1 | <?php |
||
2 | |||
3 | namespace Austomos\OAuth2\Client\Test\Provider; |
||
4 | |||
5 | use Austomos\OAuth2\Client\Provider\ChasterAppResourceOwner; |
||
6 | use PHPUnit\Framework\TestCase; |
||
7 | |||
8 | class ChasterAppResourceOwnerTest extends TestCase |
||
9 | { |
||
10 | /** @noinspection PhpUndefinedFieldInspection */ |
||
11 | public function testNamedFieldWithValidData(): void |
||
12 | { |
||
13 | $profile = new ChasterAppResourceOwner([ |
||
14 | '_id' => 'mock_id', |
||
15 | 'username' => 'mock_username', |
||
16 | 'email' => 'mock_email', |
||
17 | 'mock' => 'mock_value' |
||
18 | ]); |
||
19 | $this->assertEquals('mock_id', $profile->getId()); |
||
20 | $this->assertEquals('mock_id', $profile->toArray()['_id']); |
||
21 | $this->assertEquals('mock_id', $profile->_id); |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
22 | |||
23 | $this->assertEquals('mock_username', $profile->getUsername()); |
||
24 | $this->assertEquals('mock_username', $profile->toArray()['username']); |
||
25 | $this->assertEquals('mock_username', $profile->username); |
||
0 ignored issues
–
show
The property
username does not exist on Austomos\OAuth2\Client\P...ChasterAppResourceOwner . Since you implemented __get , consider adding a @property annotation.
![]() |
|||
26 | |||
27 | $this->assertEquals('mock_email', $profile->getEmail()); |
||
28 | $this->assertEquals('mock_email', $profile->toArray()['email']); |
||
29 | $this->assertEquals('mock_email', $profile->email); |
||
0 ignored issues
–
show
The property
email does not exist on Austomos\OAuth2\Client\P...ChasterAppResourceOwner . Since you implemented __get , consider adding a @property annotation.
![]() |
|||
30 | |||
31 | $this->assertEquals('mock_value', $profile->toArray()['mock']); |
||
32 | $this->assertEquals('mock_value', $profile->mock); |
||
0 ignored issues
–
show
The property
mock does not exist on Austomos\OAuth2\Client\P...ChasterAppResourceOwner . Since you implemented __get , consider adding a @property annotation.
![]() |
|||
33 | $this->assertEquals(null, $profile->invalidMock); |
||
0 ignored issues
–
show
The property
invalidMock does not exist on Austomos\OAuth2\Client\P...ChasterAppResourceOwner . Since you implemented __get , consider adding a @property annotation.
![]() |
|||
34 | } |
||
35 | |||
36 | /** @noinspection PhpUndefinedFieldInspection */ |
||
37 | public function testNamedFieldWithInvalidData(): void |
||
38 | { |
||
39 | $profile = new ChasterAppResourceOwner([]); |
||
40 | $this->assertEquals('', $profile->getId()); |
||
41 | $this->assertArrayNotHasKey('_id', $profile->toArray()); |
||
42 | $this->assertEquals(null, $profile->_id); |
||
0 ignored issues
–
show
The property
_id does not exist on Austomos\OAuth2\Client\P...ChasterAppResourceOwner . Since you implemented __get , consider adding a @property annotation.
![]() |
|||
43 | |||
44 | $this->assertEquals('', $profile->getUsername()); |
||
45 | $this->assertArrayNotHasKey('username', $profile->toArray()); |
||
46 | $this->assertEquals(null, $profile->username); |
||
0 ignored issues
–
show
The property
username does not exist on Austomos\OAuth2\Client\P...ChasterAppResourceOwner . Since you implemented __get , consider adding a @property annotation.
![]() |
|||
47 | |||
48 | $this->assertEquals('', $profile->getEmail()); |
||
49 | $this->assertArrayNotHasKey('email', $profile->toArray()); |
||
50 | $this->assertEquals(null, $profile->email); |
||
0 ignored issues
–
show
The property
email does not exist on Austomos\OAuth2\Client\P...ChasterAppResourceOwner . Since you implemented __get , consider adding a @property annotation.
![]() |
|||
51 | |||
52 | $this->assertArrayNotHasKey('mock', $profile->toArray()); |
||
53 | $this->assertEquals(null, $profile->mock); |
||
0 ignored issues
–
show
The property
mock does not exist on Austomos\OAuth2\Client\P...ChasterAppResourceOwner . Since you implemented __get , consider adding a @property annotation.
![]() |
|||
54 | } |
||
55 | } |
||
56 |