1313
1414use function PHPUnit \Framework \assertFalse ;
1515use function PHPUnit \Framework \assertInstanceOf ;
16+ use function PHPUnit \Framework \assertNull ;
1617use function PHPUnit \Framework \assertSame ;
1718use function PHPUnit \Framework \assertTrue ;
1819
1920final class BusinessConnectionTest extends TestCase
2021{
2122 public function testBase (): void
23+ {
24+ $ user = new User (123 , false , 'Sergei ' );
25+ $ date = new DateTimeImmutable ();
26+ $ businessConnection = new BusinessConnection (
27+ 'id1 ' ,
28+ $ user ,
29+ 23 ,
30+ $ date ,
31+ false ,
32+ );
33+
34+ assertSame ('id1 ' , $ businessConnection ->id );
35+ assertSame ($ user , $ businessConnection ->user );
36+ assertSame (23 , $ businessConnection ->userChatId );
37+ assertSame ($ date , $ businessConnection ->date );
38+ assertFalse ($ businessConnection ->isEnabled );
39+ assertNull ($ businessConnection ->rights );
40+ }
41+
42+ public function testFull (): void
2243 {
2344 $ user = new User (123 , false , 'Sergei ' );
2445 $ date = new DateTimeImmutable ();
@@ -28,16 +49,16 @@ public function testBase(): void
2849 $ user ,
2950 23 ,
3051 $ date ,
31- $ rights ,
3252 false ,
53+ $ rights ,
3354 );
3455
3556 assertSame ('id1 ' , $ businessConnection ->id );
3657 assertSame ($ user , $ businessConnection ->user );
3758 assertSame (23 , $ businessConnection ->userChatId );
3859 assertSame ($ date , $ businessConnection ->date );
39- assertSame ($ rights , $ businessConnection ->rights );
4060 assertFalse ($ businessConnection ->isEnabled );
61+ assertSame ($ rights , $ businessConnection ->rights );
4162 }
4263
4364 public function testFromTelegramResult (): void
@@ -51,18 +72,18 @@ public function testFromTelegramResult(): void
5172 ],
5273 'user_chat_id ' => 23 ,
5374 'date ' => 1717517779 ,
75+ 'is_enabled ' => false ,
5476 'rights ' => [
5577 'can_edit_bio ' => true ,
5678 ],
57- 'is_enabled ' => false ,
5879 ], null , BusinessConnection::class);
5980
6081 assertSame ('id1 ' , $ businessConnection ->id );
6182 assertSame (123 , $ businessConnection ->user ->id );
6283 assertSame (23 , $ businessConnection ->userChatId );
6384 assertSame (1717517779 , $ businessConnection ->date ->getTimestamp ());
6485 assertInstanceOf (BusinessBotRights::class, $ businessConnection ->rights );
65- assertTrue ($ businessConnection ->rights ->canEditBio );
6686 assertFalse ($ businessConnection ->isEnabled );
87+ assertTrue ($ businessConnection ->rights ->canEditBio );
6788 }
6889}
0 commit comments